video: hold frame for non-tunnel mode [1/1]
authorshuanglong.wang <shuanglong.wang@amlogic.com>
Fri, 22 Mar 2019 02:36:38 +0000 (10:36 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 1 Apr 2019 12:16:04 +0000 (05:16 -0700)
PD#SWPL-6179

Problem:
PLAY-AL1-30FPS-HEAAC exist multi short frame every 16.6s

Solution:
Hold one frame in case occur pattern broken. Problem occur as this,
for non-tunnel mode, amlvideo vidioc_dqbuf  in omx so fast, then lead
decoder buffer quickly pushed to amlvideo queue with only current frame,
without next frame. Hold one frame we need next frame and next frame pts
after next frame, here we use next frame pts and a crease with duraion
as next next frame pts.

Verify:
verify by u212

Change-Id: Ie98c30791e785abb886aa19a7e930d191f5c2b3e
Signed-off-by: shuanglong.wang <shuanglong.wang@amlogic.com>
drivers/amlogic/media/video_sink/video.c

index c00ee26..9fedc05 100644 (file)
@@ -573,6 +573,9 @@ static int pts_trace;
 #define PTS_32_PATTERN_DETECT_RANGE 10
 #define PTS_22_PATTERN_DETECT_RANGE 10
 #define PTS_41_PATTERN_DETECT_RANGE 2
+#define PTS_32_PATTERN_DURATION 3750
+#define PTS_22_PATTERN_DURATION 3000
+
 
 enum video_refresh_pattern {
        PTS_32_PATTERN = 0,
@@ -5160,10 +5163,13 @@ static inline void vpts_perform_pulldown(struct vframe_s *next_vf,
 {
        int pattern_range, expected_curr_interval;
        int expected_prev_interval;
+       int next_vf_nextpts = 0;
 
        /* Dont do anything if we have invalid data */
-       if (!next_vf || !next_vf->pts || !next_vf->next_vf_pts_valid)
+       if (!next_vf || !next_vf->pts)
                return;
+       if (next_vf->next_vf_pts_valid)
+               next_vf_nextpts = next_vf->next_vf_pts;
 
        switch (pts_pattern_detected) {
        case PTS_32_PATTERN:
@@ -5180,6 +5186,9 @@ static inline void vpts_perform_pulldown(struct vframe_s *next_vf,
                default:
                        return;
                }
+               if (!next_vf_nextpts)
+                       next_vf_nextpts = next_vf->pts +
+                               PTS_32_PATTERN_DURATION;
                break;
        case PTS_22_PATTERN:
                if (pre_pts_trace != 2)
@@ -5187,6 +5196,9 @@ static inline void vpts_perform_pulldown(struct vframe_s *next_vf,
                pattern_range =  PTS_22_PATTERN_DETECT_RANGE;
                expected_prev_interval = 2;
                expected_curr_interval = 2;
+               if (!next_vf_nextpts)
+                       next_vf_nextpts = next_vf->pts +
+                               PTS_22_PATTERN_DURATION;
                break;
        case PTS_41_PATTERN:
                /* TODO */
@@ -5209,7 +5221,7 @@ static inline void vpts_perform_pulldown(struct vframe_s *next_vf,
                        if (/*((int)(nextPts + expected_prev_interval * */
                        /*vsync_pts_inc - next_vf->next_vf_pts) < 0) && */
                                ((int)(nextPts + (expected_prev_interval + 1) *
-                               vsync_pts_inc - next_vf->next_vf_pts) >= 0)) {
+                               vsync_pts_inc - next_vf_nextpts) >= 0)) {
                                *expired = false;
                                if (pts_log_enable[PTS_32_PATTERN]
                                        || pts_log_enable[PTS_22_PATTERN])
@@ -5242,9 +5254,9 @@ static inline void vpts_perform_pulldown(struct vframe_s *next_vf,
                                >= 0) &&
                            ((int)(nextPts +
                            vsync_pts_inc * (expected_prev_interval - 1)
-                           - next_vf->next_vf_pts) < 0) &&
+                           - next_vf_nextpts) < 0) &&
                            ((int)(nextPts + expected_prev_interval *
-                               vsync_pts_inc - next_vf->next_vf_pts) >= 0)) {
+                               vsync_pts_inc - next_vf_nextpts) >= 0)) {
                                *expired = true;
                                if (pts_log_enable[PTS_32_PATTERN]
                                        || pts_log_enable[PTS_22_PATTERN])