avs: fixed avs pts abnormal issue. [1/1]
authoryunmin.chen <yunmin.chen@amlogic.com>
Fri, 24 Apr 2020 10:32:17 +0000 (18:32 +0800)
committerYunmin Chen <yunmin.chen@amlogic.com>
Mon, 8 Jun 2020 07:30:51 +0000 (00:30 -0700)
PD#OTT-10155

Problem:
The player inputs an abnormal pts to the decoder.

Solution:
Only the PTS of the I frame is retained.

Verify:
S905X2

Change-Id: I5085d2c9eb1649d39c98a5db015951adaa6c45e6
Signed-off-by: yunmin.chen <yunmin.chen@amlogic.com>
drivers/frame_provider/decoder/avs/avs.c

index b6e500f27447a5adf63db625d158899e491eca1a..323f3225b3891b61fb3061d2de6262394a647adb 100644 (file)
@@ -524,6 +524,7 @@ static void vavs_isr(void)
                        pic_type = 2;
                        if ((picture_type == I_PICTURE) && pts_valid) {
                                vf->pts = pts;
+                               vf->pts_us64 = pts_us64;
                                if ((repeat_count > 1) && avi_flag) {
                                        /* next_pts = pts +
                                         *   (vavs_amstream_dec_info.rate *
@@ -537,6 +538,9 @@ static void vavs_isr(void)
                                        next_pts = 0;
                        } else {
                                vf->pts = next_pts;
+                               if (vf->pts == 0) {
+                                       vf->pts_us64 = 0;
+                               }
                                if ((repeat_count > 1) && avi_flag) {
                                        /* vf->duration =
                                         *   vavs_amstream_dec_info.rate *
@@ -578,8 +582,11 @@ static void vavs_isr(void)
                                pr_info("buffer_index %d, canvas addr %x\n",
                                           buffer_index, vf->canvas0Addr);
                        }
-                        vf->pts = (pts_valid)?pts:0;
-                       vf->pts_us64 = (pts_valid) ? pts_us64 : 0;
+
+                       vf->pts = (pts_valid)?pts:0;
+                       /*
+                       *vf->pts_us64 = (pts_valid) ? pts_us64 : 0;
+                       */
                        vfbuf_use[buffer_index]++;
                        vf->mem_handle =
                                decoder_bmmu_box_get_mem_handle(
@@ -603,7 +610,9 @@ static void vavs_isr(void)
                                vf->pts = 0;
                        else
                        vf->pts = next_pts;
-
+                       if (vf->pts == 0) {
+                               vf->pts_us64 = 0;
+                       }
                        if ((repeat_count > 1) && avi_flag) {
                                /* vf->duration = vavs_amstream_dec_info.rate *
                                 *   repeat_count >> 1;
@@ -681,6 +690,9 @@ static void vavs_isr(void)
                                        next_pts = 0;
                        } else {
                                vf->pts = next_pts;
+                               if (vf->pts == 0) {
+                                       vf->pts_us64 = 0;
+                               }
                                if ((repeat_count > 1) && avi_flag) {
                                        /* vf->duration =
                                         *   vavs_amstream_dec_info.rate *
@@ -711,7 +723,9 @@ static void vavs_isr(void)
                                index2canvas(buffer_index);
                        vf->type_original = vf->type;
                        vf->pts = (pts_valid)?pts:0;
-                       vf->pts_us64 = (pts_valid) ? pts_us64 : 0;
+                       /*
+                       *vf->pts_us64 = (pts_valid) ? pts_us64 : 0;
+                       */
                        if (debug_flag & AVS_DEBUG_PRINT) {
                                pr_info("buffer_index %d, canvas addr %x\n",
                                           buffer_index, vf->canvas0Addr