[vlc-devel] [PATCH 1/2] mp4 demux: ensure the PTS is set (to the DTS)

Laurent Aimar fenrir at elivagar.org
Sun Nov 13 10:58:16 CET 2011


On Sun, Nov 13, 2011 at 12:27:07AM -0500, Rafaël Carré wrote:
> Also for videos (in case we didn't find the ctts box)
> ---
>  modules/demux/mp4/mp4.c |    4 +---
>  1 files changed, 1 insertions(+), 3 deletions(-)
> 
> diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
> index 9561d0f..a9914e7 100644
> --- a/modules/demux/mp4/mp4.c
> +++ b/modules/demux/mp4/mp4.c
> @@ -738,10 +738,8 @@ static int Demux( demux_t *p_demux )
>                  i_delta = MP4_TrackGetPTSDelta( tk );
>                  if( i_delta != -1 )
>                      p_block->i_pts = p_block->i_dts + i_delta;
> -                else if( tk->fmt.i_cat != VIDEO_ES )
> -                    p_block->i_pts = p_block->i_dts;
>                  else
> -                    p_block->i_pts = VLC_TS_INVALID;
> +                    p_block->i_pts = p_block->i_dts;

Sadly, this is not right. MP4 files can miss the ctts but still have B frames
(or out of ourder I/P). With this patch, such file will now have a jerky
playback.

IMHO, The only proper way to fix this issue, is to improve the H264 packetizer
but it will be a lot of work.

-- 
fenrir



More information about the vlc-devel mailing list