Commit 5a72f814 authored by Frédéric Yhuel's avatar Frédéric Yhuel Committed by Jean-Baptiste Kempf

demux/mp4: fix PTS computation

p_sample_offset_pts must be NULL if MP4_TRUN_SAMPLE_TIME_OFFSET is not
present. Then MP4_TrackGetPTSDelta would return -1 (instead of 0
previously), and PTS of video frames would be set to VLC_TS_INVALID,
which is the right thing to do in that case.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent a9ebdde4
......@@ -3459,11 +3459,16 @@ static int MP4_frg_GetChunk( demux_t *p_demux, MP4_Box_t *p_chunk, unsigned *i_t
return VLC_ENOMEM;
ret->p_sample_count_pts = calloc( ret->i_sample_count, sizeof( uint32_t ) );
ret->p_sample_offset_pts = calloc( ret->i_sample_count, sizeof( int32_t ) );
if( !ret->p_sample_count_pts || !ret->p_sample_offset_pts )
if( !ret->p_sample_count_pts )
return VLC_ENOMEM;
if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_TIME_OFFSET )
{
ret->p_sample_offset_pts = calloc( ret->i_sample_count, sizeof( int32_t ) );
if( !ret->p_sample_offset_pts )
return VLC_ENOMEM;
}
ret->p_sample_size = calloc( ret->i_sample_count, sizeof( uint32_t ) );
if( !ret->p_sample_size )
return VLC_ENOMEM;
......@@ -3489,13 +3494,11 @@ static int MP4_frg_GetChunk( demux_t *p_demux, MP4_Box_t *p_chunk, unsigned *i_t
ret->p_sample_count_dts[i] = ret->p_sample_count_pts[i] = 1;
if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_TIME_OFFSET )
if( ret->p_sample_offset_pts )
{
ret->p_sample_offset_pts[i] =
p_trun_data->p_samples[i].i_composition_time_offset;
}
else
ret->p_sample_offset_pts[i] = 0;
if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_SIZE )
len = ret->p_sample_size[i] = p_trun_data->p_samples[i].i_size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment