[vlc-commits] mux: ts: handle borked dts in mux
Francois Cartegnie
git at videolan.org
Tue Apr 17 19:36:13 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr 17 19:35:19 2018 +0200| [b71afa275dc68448693bed83dd6f98034ce08120] | committer: Francois Cartegnie
mux: ts: handle borked dts in mux
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b71afa275dc68448693bed83dd6f98034ce08120
---
modules/mux/mpeg/ts.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index c3b0d6d33a..c3b715a7c4 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -1274,7 +1274,9 @@ static bool MuxStreams(sout_mux_t *p_mux )
(p_input->p_fmt->i_codec != VLC_CODEC_MP3) ) )
{
p_data = block_FifoGet( p_input->p_fifo );
- if (p_data->i_pts <= VLC_TS_INVALID)
+ if( p_data->i_dts <= VLC_TS_INVALID )
+ p_data->i_dts = p_data->i_pts;
+ else if ( p_data->i_pts <= VLC_TS_INVALID )
p_data->i_pts = p_data->i_dts;
if( p_input->p_fmt->i_codec == VLC_CODEC_MP4A )
@@ -1287,6 +1289,13 @@ static bool MuxStreams(sout_mux_t *p_mux )
SetBlockDuration( p_input, p_data );
+ if( p_data->i_dts == VLC_TS_INVALID )
+ {
+ msg_Err( p_mux, "non dated packet dropped" );
+ block_Release( p_data );
+ continue;
+ }
+
if ( p_sys->first_dts == 0 )
{
/* Pick the really first DTS */
@@ -1638,8 +1647,10 @@ static block_t *FixPES( sout_mux_t *p_mux, block_fifo_t *p_fifo )
i_copy = __MIN( STD_PES_PAYLOAD - i_size, p_next->i_buffer );
memcpy( &p_data->p_buffer[i_size], p_next->p_buffer, i_copy );
- p_next->i_pts += p_next->i_length * i_copy / p_next->i_buffer;
- p_next->i_dts += p_next->i_length * i_copy / p_next->i_buffer;
+ if( p_next->i_pts )
+ p_next->i_pts += p_next->i_length * i_copy / p_next->i_buffer;
+ if( p_next->i_dts )
+ p_next->i_dts += p_next->i_length * i_copy / p_next->i_buffer;
p_next->i_length -= p_next->i_length * i_copy / p_next->i_buffer;
p_next->i_buffer -= i_copy;
p_next->p_buffer += i_copy;
More information about the vlc-commits
mailing list