[vlc-commits] mux: avformat: simpler reset-ts implementation

Thomas Guillem git at videolan.org
Fri Jan 18 10:26:07 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jan 18 10:22:52 2019 +0100| [e8269340661d6d28b613dd913787b20ca8ac2b0d] | committer: Thomas Guillem

mux: avformat: simpler reset-ts implementation

Use oc->avoid_negative_ts that is available in ffmpeg and libav.

Fixes #21743

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

 modules/demux/avformat/mux.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index e2e256d9de..7244f51ffc 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -64,7 +64,6 @@ typedef struct
 #if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
     bool     b_header_done;
 #endif
-    bool     b_reset_ts;
 } sout_mux_sys_t;
 
 /*****************************************************************************
@@ -151,7 +150,8 @@ int avformat_OpenMux( vlc_object_t *p_this )
     p_sys->io->write_data_type = IOWriteTyped;
     p_sys->b_header_done = false;
 #endif
-    p_sys->b_reset_ts = var_GetBool( p_mux, "sout-avformat-reset-ts" );
+    if( var_GetBool( p_mux, "sout-avformat-reset-ts" ) )
+        p_sys->oc->avoid_negative_ts = AVFMT_AVOID_NEG_TS_MAKE_ZERO;
 
     /* Fill p_mux fields */
     p_mux->pf_control   = Control;
@@ -373,15 +373,8 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
     }
 
     if( p_data->i_pts > 0 )
-    {
-        if( p_sys->b_reset_ts )
-        {
-            p_sys->oc->output_ts_offset = -p_data->i_pts;
-            p_sys->b_reset_ts = false;
-        }
         pkt.pts = TO_AV_TS(p_data->i_pts * p_stream->time_base.den /
             CLOCK_FREQ / p_stream->time_base.num);
-    }
     if( p_data->i_dts > 0 )
         pkt.dts = TO_AV_TS(p_data->i_dts * p_stream->time_base.den /
             CLOCK_FREQ / p_stream->time_base.num);



More information about the vlc-commits mailing list