media: ptsserv: set pts_us64 in pts_lookup_offset
authorrongrong zhou <rongrong.zhou@amlogic.com>
Fri, 20 Jul 2018 06:11:16 +0000 (14:11 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Wed, 25 Jul 2018 10:14:03 +0000 (03:14 -0700)
PD#170127: media: ptsserv: set pts_us64 in pts_lookup_offset

Setiting pts_us64 prevents the decoder from using uninitialized values,
Sometimes the function return pts valid only if pts is set.

Change-Id: If4b0a329bbc013902fd2045207420f0f85bfff4e
Signed-off-by: rongrong zhou <rongrong.zhou@amlogic.com>
drivers/amlogic/media/frame_sync/ptsserv.c

index 295507b..de2e8b5 100644 (file)
@@ -65,6 +65,7 @@ struct pts_table_s {
        u32 lookup_cache_offset;
        bool lookup_cache_valid;
        u32 lookup_cache_pts;
+       u64 lookup_cache_pts_uS64;
        unsigned long buf_start;
        u32 buf_size;
        int first_checkin_pts;
@@ -686,6 +687,7 @@ static int pts_lookup_offset_inline_locked(u8 type, u32 offset, u32 *val,
                if ((pTable->lookup_cache_valid) &&
                        (offset == pTable->lookup_cache_offset)) {
                        *val = pTable->lookup_cache_pts;
+                       *uS64 = pTable->lookup_cache_pts_uS64;
                        return 0;
                }
 
@@ -803,6 +805,7 @@ static int pts_lookup_offset_inline_locked(u8 type, u32 offset, u32 *val,
 #endif
 
                        pTable->lookup_cache_pts = *val;
+                       pTable->lookup_cache_pts_uS64 = *uS64;
                        pTable->lookup_cache_offset = offset;
                        pTable->lookup_cache_valid = true;
 
@@ -899,8 +902,8 @@ static int pts_lookup_offset_inline_locked(u8 type, u32 offset, u32 *val,
                                                                p->val);
                                        }
                                }
+                               return 0;
                        }
-                       return 0;
                }
 #endif
                else {
@@ -910,6 +913,7 @@ static int pts_lookup_offset_inline_locked(u8 type, u32 offset, u32 *val,
                         */
                        if (!pTable->first_lookup_ok) {
                                *val = pTable->first_checkin_pts;
+                               *uS64 = (u64)(*val) << 32;
                                pTable->first_lookup_ok = 1;
                                pTable->first_lookup_is_fail = 1;