changeset 32866:9acb64ec6484

Improve handling of audio timestamps where we do not have even a single valid time-stamp nor a bit-rate.
author reimar
date Tue, 22 Feb 2011 18:58:50 +0000
parents 25d2ef30d784
children 454f6decbd93
files mpcommon.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mpcommon.c	Tue Feb 22 18:52:48 2011 +0000
+++ b/mpcommon.c	Tue Feb 22 18:58:50 2011 +0000
@@ -471,6 +471,12 @@
         return MP_NOPTS_VALUE;
     // first calculate the end pts of audio that has been output by decoder
     a_pts = sh_audio->pts;
+    // If we cannot get any useful information at all from the demuxer layer
+    // just count the decoded bytes. This is still better than constantly
+    // resetting to 0.
+    if (sh_audio->pts_bytes && a_pts == MP_NOPTS_VALUE &&
+        !d_audio->pts && !sh_audio->i_bps)
+        a_pts = 0;
     if (a_pts != MP_NOPTS_VALUE)
         // Good, decoder supports new way of calculating audio pts.
         // sh_audio->pts is the timestamp of the latest input packet with