From b9036e639edae99c6207ff98977fc01ad038a5c9 Mon Sep 17 00:00:00 2001 From: Peng Yixin Date: Mon, 7 Sep 2020 17:23:26 +0800 Subject: [PATCH] media_module: h265 fixed same frame being written to DPB multiple times [1/1] PD#SWPL-30901 Problem: In stream mode, multiple frames are decoded in a decoding process, but at last there is insufficient data. As a result, other frames are stored in DPB except last frame. However, the next run will be decode again and stored in DPB, which results in the same frame being stored in DPB for many times and cause playback stuck. Solution: In this case, release all the frames stored in the DPB in this decoding process to resolve this problem. Verify: U215 Change-Id: I1f1360467a5bfb364cde03268857922ca05b8d75 Signed-off-by: Peng Yixin --- drivers/frame_provider/decoder/h265/vh265.c | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/frame_provider/decoder/h265/vh265.c b/drivers/frame_provider/decoder/h265/vh265.c index 22b30c9..974c144 100644 --- a/drivers/frame_provider/decoder/h265/vh265.c +++ b/drivers/frame_provider/decoder/h265/vh265.c @@ -2188,6 +2188,30 @@ static void restore_decode_state(struct hevc_state_s *hevc) release_aux_data(hevc, hevc->decoding_pic); hevc->decoding_pic = NULL; } + if (vdec_stream_based(vdec) && + (hevc->decode_idx - hevc->decode_idx_bak > 1)) { + int i; + for (i = 0; i < MAX_REF_PIC_NUM; i++) { + struct PIC_s *pic; + pic = hevc->m_PIC[i]; + if (pic == NULL || + (pic->index == -1) || + (pic->BUF_index == -1) || + (pic->POC == INVALID_POC)) + continue; + if ((hevc->decode_idx > hevc->decode_idx_bak) && + pic->decode_idx != hevc->decode_idx) { + hevc_print(hevc, 0, "release error buffer\n"); + pic->error_mark = 0; + pic->output_ready = 0; + pic->output_mark = 0; + pic->referenced = 0; + pic->POC = INVALID_POC; + put_mv_buf(hevc, pic); + release_aux_data(hevc, pic); + } + } + } hevc->decode_idx = hevc->decode_idx_bak; hevc->m_pocRandomAccess = hevc->m_pocRandomAccess_bak; hevc->curr_POC = hevc->curr_POC_bak; -- 2.20.1