From eed8ec347fb491fbc68d4f2a9d6e75a9bb27334f Mon Sep 17 00:00:00 2001 From: Hongjin Li Date: Wed, 24 Sep 2025 09:44:45 +0800 Subject: [PATCH] fix[hal_av1d_vdpu383]: Fix Roku player crash after seeking. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Platform: RK3576(vdpu383) Spec: av1 Error case: When using the Roku player, it crashes after seeking. Because dxva->frame_refs[mapped_idx].Index == -1, cdf_buf becomes NULL, which leads to a crash. The deeper cause is that after seeking, playback doesn’t start from an I-frame, so the reference frame info isn’t ready. Err log: Null pointer crash stack. Solution: Check frame_refs index validity to avoid crashes. Source: test_av1_1920x1080.mp4 (Likely reproducible with other AV1 sources.) Reported-by: Liming Xu Signed-off-by: Hongjin Li Change-Id: Id55c2b00aa4c42eec2ccd780974e933a052864de --- mpp/hal/rkdec/av1d/hal_av1d_vdpu383.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mpp/hal/rkdec/av1d/hal_av1d_vdpu383.c b/mpp/hal/rkdec/av1d/hal_av1d_vdpu383.c index fdaec870..33de1705 100644 --- a/mpp/hal/rkdec/av1d/hal_av1d_vdpu383.c +++ b/mpp/hal/rkdec/av1d/hal_av1d_vdpu383.c @@ -2112,7 +2112,9 @@ static void vdpu383_av1d_set_cdf(Av1dHalCtx *p_hal, DXVA_PicParams_AV1 *dxva) coeff_cdf_idx = reg_ctx->ref_info_tbl[mapped_idx].coeff_idx; if (!dxva->coding.disable_frame_end_update_cdf && - reg_ctx->ref_info_tbl[mapped_idx].cdf_valid) { + reg_ctx->ref_info_tbl[mapped_idx].cdf_valid && + dxva->frame_refs[mapped_idx].Index != (CHAR)0xff && + dxva->frame_refs[mapped_idx].Index != 0x7f) { cdf_buf = hal_bufs_get_buf(reg_ctx->cdf_segid_bufs, dxva->frame_refs[mapped_idx].Index); buf_tmp = cdf_buf->buf[0]; } else {