Commit 7542b6c8b2 for aom
commit 7542b6c8b240e3b21dc386dcb8f4020ccfacb556
Author: Alejandro Pacheco <alepacheco99@gmail.com>
Date: Wed Oct 14 10:15:15 2026 +0200
encodeframe_utils: handle a NULL last_source
In realtime mode with lag_in_frames > 0 and internal ARFs, the first
frame that is not shown can be encoded before any last source exists,
so cpi->last_source is NULL and av1_source_content_sb() dereferenced
it. Return early in that case. The next change adds a test that
reaches this path.
Bug: 573427857
Change-Id: I0d31415f8ef07c207d3f82dd16aa3cd2565d9c3d
diff --git a/av1/encoder/encodeframe_utils.c b/av1/encoder/encodeframe_utils.c
index 7a3fbcddf2..8fb46a88f6 100644
--- a/av1/encoder/encodeframe_utils.c
+++ b/av1/encoder/encodeframe_utils.c
@@ -1494,7 +1494,9 @@ static int fast_detect_non_zero_motion(AV1_COMP *cpi, const uint8_t *src_y,
// its collocated block in the last frame.
void av1_source_content_sb(AV1_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data,
int mi_row, int mi_col) {
- if (cpi->last_source->y_width != cpi->source->y_width ||
+ // There is no last source for a frame that is not shown (an ARF).
+ if (cpi->last_source == NULL ||
+ cpi->last_source->y_width != cpi->source->y_width ||
cpi->last_source->y_height != cpi->source->y_height)
return;
#if CONFIG_AV1_HIGHBITDEPTH