From a0ffb8c688b56bd6df67539892010d0456b25b82 Mon Sep 17 00:00:00 2001 From: Jian Wang Date: Sat, 9 May 2020 21:05:47 +0800 Subject: [PATCH] secure: fix drop frame when nts test [1/1] PD#SWPL-24587 Problem: 1. when one package have more frame, some buf handle is 0 at start one package and lastest buf is valid, so when get freed handle often get invalid duo to apk do not have input buf enough and drop frame 2. next pts often is 0, duo to video check parten error Solution: 1. get freed handle only retrun no-zero handle 2. if next pts is 0, use current pts add duration Verify: verify on TM2. Change-Id: I4f9f0b30e66621bce76a66d093a2d5334583020f Signed-off-by: Jian Wang --- drivers/frame_provider/decoder/utils/vdec_input.c | 11 ++++++++--- drivers/frame_provider/decoder/vav1/vav1.c | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/frame_provider/decoder/utils/vdec_input.c b/drivers/frame_provider/decoder/utils/vdec_input.c index a8ae25a..767bf9a 100644 --- a/drivers/frame_provider/decoder/utils/vdec_input.c +++ b/drivers/frame_provider/decoder/utils/vdec_input.c @@ -1141,14 +1141,19 @@ u32 vdec_input_get_freed_handle(struct vdec_s *vdec) return 0; flags = vdec_input_lock(input); - block = list_first_entry_or_null(&input->vframe_block_free_list, + do { + block = list_first_entry_or_null(&input->vframe_block_free_list, struct vframe_block_list_s, list); + if (!block) { + break; + } - if (block) { handle = block->handle; vdec_input_del_block_locked(input, block); kfree(block); - } + + } while(!handle); + vdec_input_unlock(input, flags); return handle; } diff --git a/drivers/frame_provider/decoder/vav1/vav1.c b/drivers/frame_provider/decoder/vav1/vav1.c index 93578b5..04f8edc 100644 --- a/drivers/frame_provider/decoder/vav1/vav1.c +++ b/drivers/frame_provider/decoder/vav1/vav1.c @@ -5682,6 +5682,11 @@ static int prepare_display_buf(struct AV1HW_s *hw, if (vf->pts != 0) hw->last_lookup_pts = vf->pts; + if (hw->frame_dur && ((vf->pts == 0) || (vf->pts_us64 == 0))) { + vf->pts = hw->last_pts + DUR2PTS(hw->frame_dur); + vf->pts_us64 = hw->last_pts_us64 + + (DUR2PTS(hw->frame_dur) * 100 / 9); + } if ((hw->pts_mode == PTS_NONE_REF_USE_DURATION) && (slice_type != KEY_FRAME)) -- 2.20.1