secure: fix drop frame when nts test [1/1]
authorJian Wang <jian.wang@amlogic.com>
Sat, 9 May 2020 13:05:47 +0000 (21:05 +0800)
committerZhi Zhou <zhi.zhou@amlogic.com>
Wed, 20 May 2020 02:22:32 +0000 (19:22 -0700)
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 <jian.wang@amlogic.com>
drivers/frame_provider/decoder/utils/vdec_input.c
drivers/frame_provider/decoder/vav1/vav1.c

index a8ae25aa2705869403b3ec7a19785e5893b045f6..767bf9a7d098228ca5b6fd02a150c96da9914e81 100644 (file)
@@ -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;
 }
index 93578b52ecd23e8bf26f767db43b1aad19a6709c..04f8edc439d4a1cd63073bf2b880f5c4f5c0fde5 100644 (file)
@@ -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))