[vlc-commits] demux: ts: fix offset units

Francois Cartegnie git at videolan.org
Tue Apr 16 17:13:20 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr 16 16:22:05 2019 +0200| [225f3a790ad8afda94856522f50ce2b6d33dc049] | committer: Francois Cartegnie

demux: ts: fix offset units

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

 modules/demux/mpeg/ts.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 1f9d9d4fac..ff753aa9b2 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1618,7 +1618,10 @@ static void ParsePESDataChain( demux_t *p_demux, ts_pid_t *pid, block_t *p_pes )
                 if ( p_pmt->pcr.b_disable && p_block->i_dts != VLC_TICK_INVALID &&
                      ( p_pmt->i_pid_pcr == pid->i_pid || p_pmt->i_pid_pcr == 0x1FFF ) )
                 {
-                    ProgramSetPCR( p_demux, p_pmt, TO_SCALE(p_block->i_dts) - 120000 );
+                    stime_t i_pcr = ( p_block->i_dts > VLC_TICK_FROM_MS(120) )
+                                  ? TO_SCALE(p_block->i_dts - VLC_TICK_FROM_MS(120))
+                                  : TO_SCALE(p_block->i_dts);
+                    ProgramSetPCR( p_demux, p_pmt, i_pcr );
                 }
 
                 /* Compute PCR/DTS offset if any */
@@ -1631,7 +1634,7 @@ static void ParsePESDataChain( demux_t *p_demux, ts_pid_t *pid, block_t *p_pes )
                     stime_t i_pcr = TimeStampWrapAround( p_pmt->pcr.i_first, p_pmt->pcr.i_current );
                     if( i_dts27 < i_pcr )
                     {
-                        p_pmt->pcr.i_pcroffset = i_pcr - i_dts27 + 80000;
+                        p_pmt->pcr.i_pcroffset = i_pcr - i_dts27 + TO_SCALE_NZ(VLC_TICK_FROM_MS(80));
                         msg_Warn( p_demux, "Broken stream: pid %d sends packets with dts %"PRId64
                                            "us later than pcr, applying delay",
                                   pid->i_pid, FROM_SCALE_NZ(p_pmt->pcr.i_pcroffset) );



More information about the vlc-commits mailing list