From dab0e75553e5663c3c13f1e87ece44028f4ed173 Mon Sep 17 00:00:00 2001 From: Yinming Ding Date: Wed, 28 Nov 2018 11:04:24 +0800 Subject: [PATCH] frame_sync: fix last few seconds of the DD+ stream are not smooth [4/4] 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 --- drivers/amlogic/media/frame_sync/ptsserv.c | 1 + drivers/amlogic/media/frame_sync/timestamp.c | 25 +++++++++++++++++++++- drivers/amlogic/media/frame_sync/tsync.c | 18 +++++++++++++++- include/linux/amlogic/media/frame_sync/timestamp.h | 6 ++++++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/drivers/amlogic/media/frame_sync/ptsserv.c b/drivers/amlogic/media/frame_sync/ptsserv.c index 0618ba0..dde139f 100644 --- a/drivers/amlogic/media/frame_sync/ptsserv.c +++ b/drivers/amlogic/media/frame_sync/ptsserv.c @@ -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()) { diff --git a/drivers/amlogic/media/frame_sync/timestamp.c b/drivers/amlogic/media/frame_sync/timestamp.c index 4c78a1ec..472be72 100644 --- a/drivers/amlogic/media/frame_sync/timestamp.c +++ b/drivers/amlogic/media/frame_sync/timestamp.c @@ -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; diff --git a/drivers/amlogic/media/frame_sync/tsync.c b/drivers/amlogic/media/frame_sync/tsync.c index bb5205c..df091fe 100644 --- a/drivers/amlogic/media/frame_sync/tsync.c +++ b/drivers/amlogic/media/frame_sync/tsync.c @@ -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 }; diff --git a/include/linux/amlogic/media/frame_sync/timestamp.h b/include/linux/amlogic/media/frame_sync/timestamp.h index e653bfa..6e27c9c 100644 --- a/include/linux/amlogic/media/frame_sync/timestamp.h +++ b/include/linux/amlogic/media/frame_sync/timestamp.h @@ -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 */ -- 2.7.4