ptsserv: fix pts lookup fail issue [3/3]
authorrongrong zhou <rongrong.zhou@amlogic.com>
Wed, 6 Mar 2019 09:59:28 +0000 (17:59 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 14 Mar 2019 05:59:09 +0000 (21:59 -0800)
PD#SWPL-3730

Problem:
playback not smooth

Solution:
if p2 lookup fail, set p2 = p

Verify:
  verified by x301

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

index dde139f..82e1213 100644 (file)
@@ -752,6 +752,11 @@ static int pts_lookup_offset_inline_locked(u8 type, u32 offset, u32 *val,
 
                                p2 = p;
                        }
+                       /* if p2 lookup fail, set p2 = p */
+                       if (type == PTS_TYPE_VIDEO && p2 && p &&
+                       OFFSET_DIFF(offset, p2->offset) > lookup_threshold &&
+                       OFFSET_DIFF(offset, p->offset) < lookup_threshold)
+                               p2 = p;
                } else if (OFFSET_LATER(p->offset, offset)) {
                        list_for_each_entry_continue_reverse(p,
                                        &pTable->