[vlc-commits] demux: ogg: add PCR gap handling warning

Francois Cartegnie git at videolan.org
Thu Jan 16 19:35:40 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jan  2 21:50:52 2014 +0100| [f16fd3003272794ddbb831a23ffd64153298ec7b] | committer: Francois Cartegnie

demux: ogg: add PCR gap handling warning

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f16fd3003272794ddbb831a23ffd64153298ec7b
---

 modules/demux/ogg.c |   14 ++++++++++++++
 modules/demux/ogg.h |    3 +++
 2 files changed, 17 insertions(+)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 24c9b29..4af503b 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -31,6 +31,7 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
+#include <vlc_access.h>
 #include <vlc_demux.h>
 #include <vlc_meta.h>
 #include <vlc_input.h>
@@ -202,6 +203,8 @@ static int Open( vlc_object_t * p_this )
     p_sys->i_length = -1;
     p_sys->b_preparsing_done = false;
 
+    stream_Control( p_demux->s, ACCESS_GET_PTS_DELAY, & p_sys->i_access_delay );
+
     /* Set exported functions */
     p_demux->pf_demux = Demux;
     p_demux->pf_control = Control;
@@ -567,6 +570,17 @@ static int Demux( demux_t * p_demux )
 
     if ( i_pcr_candidate > VLC_TS_INVALID && p_sys->i_pcr != i_pcr_candidate )
     {
+        if ( p_sys->i_streams == 1 && p_sys->i_access_delay )
+        {
+            int64_t i_pcr_jitter = i_pcr_candidate - p_sys->i_pcr;
+            if ( i_pcr_jitter > p_sys->i_pcr_jitter )
+            {
+                p_sys->i_pcr_jitter = i_pcr_jitter;
+                if ( p_sys->i_access_delay < i_pcr_jitter )
+                    msg_Warn( p_demux, "Consider increasing access caching variable from %"PRId64" to >%"PRId64,
+                              p_sys->i_access_delay / 1000, i_pcr_jitter / 1000 );
+            }
+        }
         p_sys->i_pcr = i_pcr_candidate;
         if( ! b_skipping )
             es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_pcr );
diff --git a/modules/demux/ogg.h b/modules/demux/ogg.h
index b0d8508..84f4c68 100644
--- a/modules/demux/ogg.h
+++ b/modules/demux/ogg.h
@@ -132,6 +132,9 @@ struct demux_sys_t
      * the sub-streams */
     mtime_t i_pcr;
     mtime_t i_pcr_offset;
+    /* informative only */
+    mtime_t i_pcr_jitter;
+    int64_t i_access_delay;
 
     /* new stream or starting from a chain */
     bool b_chained_boundary;



More information about the vlc-commits mailing list