mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
avsync: Use the video start pts to init pcr [3/3]
PD#SWPL-21670 Problem: Play from beginning,it will get stuck for a while Solution: Use the video start pts to init pcr if audio invalid Verify: Verified ok on patch-build Change-Id: I0673d811889cb6b9ae3301355f09b268725d472d Signed-off-by: Zhizhong Zhang <zhizhong.zhang@amlogic.com>
This commit is contained in:
@@ -380,6 +380,7 @@ u32 tsync_pcr_get_ref_pcr(void)
|
||||
u32 ref_pcr = 0;
|
||||
uint64_t audio_cache_pts = 0;
|
||||
uint64_t video_cache_pts = 0;
|
||||
uint64_t pts_cache_tmp = 0;
|
||||
int audio_cache_ms = 0;
|
||||
int video_cache_ms = 0;
|
||||
int diff = 0;
|
||||
@@ -393,20 +394,25 @@ u32 tsync_pcr_get_ref_pcr(void)
|
||||
first_apts = first_checkin_apts;
|
||||
if (!first_vpts)
|
||||
first_vpts = first_checkin_vpts;
|
||||
/*Use the firs output vpts to calc buffer cache and init pcr*/
|
||||
if (tsync_pcr_vstart_flag == 1) {
|
||||
first_vpts = tsync_pcr_first_video_frame_pts;
|
||||
pr_info("Video Start, first vpts:0x%x\n", first_vpts);
|
||||
}
|
||||
cur_checkin_vpts = get_last_checkin_pts(PTS_TYPE_VIDEO);
|
||||
cur_checkin_apts = get_last_checkin_pts(PTS_TYPE_AUDIO);
|
||||
video_cache_pts = cur_checkin_vpts - first_vpts;
|
||||
audio_cache_pts = cur_checkin_apts - first_apts;
|
||||
if ((first_apts == 0) && (cur_checkin_apts == 0xffffffff))
|
||||
audio_cache_pts = 0;
|
||||
pts_cache_tmp = audio_cache_pts;
|
||||
#ifdef CONFIG_64BIT
|
||||
audio_cache_ms = audio_cache_pts / 90;
|
||||
video_cache_ms = video_cache_pts / 90;
|
||||
#else
|
||||
do_div(audio_cache_pts, 90);
|
||||
do_div(video_cache_pts, 90);
|
||||
audio_cache_ms = audio_cache_pts;
|
||||
video_cache_ms = video_cache_pts;
|
||||
audio_cache_ms = do_div(pts_cache_tmp, 90);
|
||||
pts_cache_tmp = video_cache_pts;
|
||||
video_cache_ms = do_div(pts_cache_tmp, 90);
|
||||
#endif
|
||||
|
||||
pr_info("get_ref_pcr:apts(%x,%x,%x,cache:%dms),vpts(%x,%x,%x,cache:%dms)\n",
|
||||
|
||||
Reference in New Issue
Block a user