Mercurial > mplayer.hg
changeset 31245:a3adde0a5b83
If an invalid pts value is detected, try to to make up some if it seems
reasonable.
This avoids completely losing A-V sync e.g. when pts was not reordered correctly.
This was tested with http://samples.mplayerhq.hu/V-codecs/h264/PAFF/tv_cut.mkv
for this sample proper pts reordering is the correct solution, but more resilient
handling of the error case is still useful.
author | reimar |
---|---|
date | Thu, 03 Jun 2010 20:39:41 +0000 |
parents | 952d773404f5 |
children | cc6ee3017097 |
files | mplayer.c |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mplayer.c Thu Jun 03 17:37:58 2010 +0000 +++ b/mplayer.c Thu Jun 03 20:39:41 2010 +0000 @@ -2401,8 +2401,14 @@ if (sh_video->last_pts == MP_NOPTS_VALUE) sh_video->last_pts= sh_video->pts; else if (sh_video->last_pts > sh_video->pts) { - sh_video->last_pts = sh_video->pts; - mp_msg(MSGT_CPLAYER, MSGL_INFO, "pts value < previous\n"); + // make a guess whether this is some kind of discontinuity + // we should jump along with or some wron timestamps we + // should replace instead + if (sh_video->pts < sh_video->last_pts - 20 * sh_video->frametime) + sh_video->last_pts = sh_video->pts; + else + sh_video->pts = sh_video->last_pts + sh_video->frametime; + mp_msg(MSGT_CPLAYER, MSGL_V, "pts value < previous\n"); } frame_time = sh_video->pts - sh_video->last_pts; sh_video->last_pts = sh_video->pts;