[vlc-commits] demux: ts: store last dts on pes struct

Francois Cartegnie git at videolan.org
Mon Jul 15 08:52:00 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jul 13 17:25:00 2019 +0200| [cb1c8d6946ee1b08d47551127c45e485ff12ae2a] | committer: Francois Cartegnie

demux: ts: store last dts on pes struct

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

 modules/demux/mpeg/ts.c                 | 4 ++++
 modules/demux/mpeg/ts_streams.c         | 1 +
 modules/demux/mpeg/ts_streams_private.h | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index ce70347774..23c4b080cc 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1584,6 +1584,9 @@ static void ParsePESDataChain( demux_t *p_demux, ts_pid_t *pid, block_t *p_pes )
     if( i_pts >= 0 && i_dts < 0 )
         i_dts = i_pts;
 
+    if( i_dts >= 0 )
+        pid->u.p_stream->i_last_dts = i_dts;
+
     if( p_pes )
     {
         ts_pmt_t *p_pmt = p_es->p_program;
@@ -1901,6 +1904,7 @@ static void ReadyQueuesPostSeek( demux_t *p_demux )
 
             pid->i_cc = 0xff;
             pid->i_dup = 0;
+            pid->u.p_stream->i_last_dts = -1;
 
             if( pid->u.p_stream->prepcr.p_head )
             {
diff --git a/modules/demux/mpeg/ts_streams.c b/modules/demux/mpeg/ts_streams.c
index c5a7ec714b..84e2cbeccf 100644
--- a/modules/demux/mpeg/ts_streams.c
+++ b/modules/demux/mpeg/ts_streams.c
@@ -293,6 +293,7 @@ ts_stream_t *ts_stream_New( demux_t *p_demux, ts_pmt_t *p_program )
     pes->p_proc = NULL;
     pes->prepcr.p_head = NULL;
     pes->prepcr.pp_last = &pes->prepcr.p_head;
+    pes->i_last_dts = -1;
 
     return pes;
 }
diff --git a/modules/demux/mpeg/ts_streams_private.h b/modules/demux/mpeg/ts_streams_private.h
index 9836900806..b5646c41d7 100644
--- a/modules/demux/mpeg/ts_streams_private.h
+++ b/modules/demux/mpeg/ts_streams_private.h
@@ -138,6 +138,8 @@ struct ts_stream_t
         block_t *p_head;
         block_t **pp_last;
     } prepcr;
+
+    stime_t i_last_dts;
 };
 
 typedef struct ts_si_context_t ts_si_context_t;



More information about the vlc-commits mailing list