vlc | branch: master | Francois Cartegnie <[email protected]> | Wed Nov  9 
21:00:52 2016 +0100| [07811f4bda80d1165c8047b114144eaf2870de12] | committer: 
Francois Cartegnie

demux: ts: fix stream offset detection code

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

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

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index b5c050a..f55ee81 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1450,10 +1450,11 @@ static void ParsePESDataChain( demux_t *p_demux, 
ts_pid_t *pid, block_t *p_pes )
                    (p_es->fmt.i_cat == VIDEO_ES || p_es->fmt.i_cat == 
AUDIO_ES) )
                 {
                     int64_t i_dts27 = TO_SCALE(p_block->i_dts);
-                    i_dts27 = TimeStampWrapAround( p_pmt->pcr.i_first, 
p_pmt->pcr.i_current );
-                    if( i_dts27 < p_pmt->pcr.i_current )
+                    i_dts27 = TimeStampWrapAround( p_pmt->pcr.i_first, i_dts27 
);
+                    int64_t i_pcr = TimeStampWrapAround( p_pmt->pcr.i_first, 
p_pmt->pcr.i_current );
+                    if( i_dts27 < i_pcr )
                     {
-                        p_pmt->pcr.i_pcroffset = p_pmt->pcr.i_current - 
i_dts27 + 80000;
+                        p_pmt->pcr.i_pcroffset = i_pcr - i_dts27 + 80000;
                         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) );

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to