frame_sync: fix last few seconds of the DD+ stream are not smooth [4/4]
authorYinming Ding <yinming.ding@amlogic.com>
Wed, 28 Nov 2018 03:04:24 +0000 (11:04 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 29 Nov 2018 06:37:53 +0000 (22:37 -0800)
PD#SWPL-714

Problem:
The last few seconds of the DD+ stream are not smooth by DTV playback.

Solution:
check the apts and vpts both discontinue,then replay the stream.

Verify:
P321

Change-Id: I6cbbdecc052dfe9fef76b44f36545b231332ee12
Signed-off-by: Yinming Ding <yinming.ding@amlogic.com>
drivers/amlogic/media/frame_sync/ptsserv.c
drivers/amlogic/media/frame_sync/timestamp.c
drivers/amlogic/media/frame_sync/tsync.c
include/linux/amlogic/media/frame_sync/timestamp.h

index 0618ba0..dde139f 100644 (file)
@@ -455,6 +455,7 @@ static int pts_checkin_offset_inline(u8 type, u32 offset, u32 val, u64 uS64)
                }
                if (type == PTS_TYPE_AUDIO && pTable->first_checkin_pts == -1) {
                        pTable->first_checkin_pts = val;
+                       timestamp_checkin_firstapts_set(val);
                        /*
                         *if (tsync_get_debug_pts_checkin() &&
                         * tsync_get_debug_apts()) {
index 4c78a1e..472be72 100644 (file)
@@ -36,6 +36,7 @@ static u32 audio_pts_up;
 static u32 audio_pts_started;
 static u32 first_vpts;
 static u32 first_checkin_vpts;
+static u32 first_checkin_apts;
 static u32 first_apts;
 static u32 pcrscr_lantcy = 200*90;
 static u32 video_pts;
@@ -134,9 +135,18 @@ u32 timestamp_pcrscr_get(void)
 }
 EXPORT_SYMBOL(timestamp_pcrscr_get);
 
+u32 timestamp_tsdemux_pcr_get(void)
+{
+       if (tsdemux_pcrscr_get_cb)
+               return tsdemux_pcrscr_get_cb();
+
+       return (u32)-1;
+}
+EXPORT_SYMBOL(timestamp_tsdemux_pcr_get);
+
 void timestamp_pcrscr_set(u32 pts)
 {
-       //pr_info("timestamp_pcrscr_set system time  = %x\n", pts);
+       /*pr_info("timestamp_pcrscr_set system time  = %x\n", pts);*/
        system_time = pts;
 }
 EXPORT_SYMBOL(timestamp_pcrscr_set);
@@ -161,12 +171,25 @@ void timestamp_checkin_firstvpts_set(u32 pts)
 }
 EXPORT_SYMBOL(timestamp_checkin_firstvpts_set);
 
+void timestamp_checkin_firstapts_set(u32 pts)
+{
+       first_checkin_apts = pts;
+       pr_info("audio first checkin pts =%x\n", first_checkin_apts);
+}
+EXPORT_SYMBOL(timestamp_checkin_firstapts_set);
+
 u32 timestamp_checkin_firstvpts_get(void)
 {
        return first_checkin_vpts;
 }
 EXPORT_SYMBOL(timestamp_checkin_firstvpts_get);
 
+u32 timestamp_checkin_firstapts_get(void)
+{
+       return first_checkin_apts;
+}
+EXPORT_SYMBOL(timestamp_checkin_firstapts_get);
+
 void timestamp_firstapts_set(u32 pts)
 {
        first_apts = pts;
index bb5205c..df091fe 100644 (file)
@@ -1452,6 +1452,12 @@ static ssize_t store_vpts(struct class *class,
        return size;
 }
 
+static ssize_t show_demux_pcr(struct class *class,
+               struct class_attribute *attr, char *buf)
+{
+       return sprintf(buf, "0x%x\n", timestamp_tsdemux_pcr_get());
+}
+
 static ssize_t show_apts(struct class *class,
                struct class_attribute *attr, char *buf)
 {
@@ -1868,6 +1874,12 @@ static ssize_t show_checkin_firstvpts(struct class *class,
        return sprintf(buf, "0x%x\n", timestamp_checkin_firstvpts_get());
 }
 
+static ssize_t show_checkin_firstapts(struct class *class,
+               struct class_attribute *attr, char *buf)
+{
+       return sprintf(buf, "0x%x\n", timestamp_checkin_firstapts_get());
+}
+
 static ssize_t show_vpause_flag(struct class *class,
                struct class_attribute *attr, char *buf)
 {
@@ -2002,7 +2014,11 @@ static struct class_attribute tsync_class_attrs[] = {
        __ATTR(checkin_firstvpts, 0644, show_checkin_firstvpts,
        NULL),
        __ATTR(apts_lookup, 0644, show_apts_lookup,
-               store_apts_lookup),
+       store_apts_lookup),
+       __ATTR(demux_pcr, 0644, show_demux_pcr,
+       NULL),
+       __ATTR(checkin_firstapts, 0644, show_checkin_firstapts,
+       NULL),
        __ATTR_NULL
 };
 
index e653bfa..6e27c9c 100644 (file)
@@ -64,8 +64,14 @@ extern void timestamp_checkin_firstvpts_set(u32 pts);
 
 extern u32 timestamp_checkin_firstvpts_get(void);
 
+extern void timestamp_checkin_firstapts_set(u32 pts);
+
+extern u32 timestamp_checkin_firstapts_get(void);
+
 extern void timestamp_firstapts_set(u32 pts);
 
 extern u32 timestamp_firstapts_get(void);
 
+extern u32 timestamp_tsdemux_pcr_get(void);
+
 #endif /* TIMESTAMP_H */