[vlc-commits] mux: avformat: simpler reset-ts implementation
Thomas Guillem
git at videolan.org
Fri Jan 18 10:28:31 CET 2019
vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jan 18 10:22:52 2019 +0100| [000b19ab97e499b3c08c4babec05e8f64cd1230c] | committer: Thomas Guillem
mux: avformat: simpler reset-ts implementation
Use oc->avoid_negative_ts that is available in ffmpeg and libav.
Fixes #21743
(cherry picked from commit e8269340661d6d28b613dd913787b20ca8ac2b0d)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=000b19ab97e499b3c08c4babec05e8f64cd1230c
---
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 b838dd4816..b5b0c9a0b6 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -64,7 +64,6 @@ struct sout_mux_sys_t
#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
bool b_header_done;
#endif
- bool b_reset_ts;
};
/*****************************************************************************
@@ -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;
@@ -363,15 +363,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 = p_data->i_pts * p_stream->time_base.den /
CLOCK_FREQ / p_stream->time_base.num;
- }
if( p_data->i_dts > 0 )
pkt.dts = p_data->i_dts * p_stream->time_base.den /
CLOCK_FREQ / p_stream->time_base.num;
More information about the vlc-commits
mailing list