[vlc-commits] mux: ts: really set first dts

Francois Cartegnie git at videolan.org
Thu Jan 12 20:28:02 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jan 12 19:36:37 2017 +0100| [26f162001190e185b1a8016291394d68cdbf66a5] | committer: Francois Cartegnie

mux: ts: really set first dts

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

 modules/mux/mpeg/ts.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index c32817d..120ac31 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -1275,8 +1275,22 @@ static bool MuxStreams(sout_mux_t *p_mux )
 
         SetBlockDuration( p_input, p_data );
 
-        if (p_sys->first_dts == 0)
+        if ( p_sys->first_dts == 0 )
+        {
+            /* Pick the really first DTS */
             p_sys->first_dts = p_data->i_dts;
+            for (int j = 0; j < p_mux->i_nb_inputs; j++ )
+            {
+                if( p_mux->pp_inputs[j] != p_input &&
+                    block_FifoCount( p_mux->pp_inputs[j]->p_fifo) > 0 )
+                {
+                    block_t *p_block = block_FifoShow( p_mux->pp_inputs[j]->p_fifo );
+                    if( p_block->i_dts > VLC_TS_INVALID &&
+                        p_block->i_dts < p_sys->first_dts )
+                        p_sys->first_dts = p_block->i_dts;
+                }
+            }
+        }
 
         if( ( p_pcr_stream->state.i_pes_dts > 0 &&
               p_data->i_dts - 10 * CLOCK_FREQ > p_pcr_stream->state.i_pes_dts +



More information about the vlc-commits mailing list