[FFmpeg-devel] [PATCH] lavf/matroskaenc: avoid assert failure in case of cuepoints with duplicated PTS

Michael Niedermayer michaelni at gmx.at
Mon Feb 18 03:42:15 CET 2013


On Sun, Feb 10, 2013 at 09:44:35PM +0100, Stefano Sabatini wrote:
> Avoid to write more than one cuepoint per track and PTS in
> mkv_write_cues(). This avoids a later assertion failure on "(bytes >=
> needed_bytes)" in put_ebml_num() called from end_ebml_master(), in case
> there are several cuepoints per track with the same PTS.
> 
> This may happen with files containing packets with duplicated PTS in the
> same track.
> ---
>  libavformat/matroskaenc.c |   17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 5c1e2f1..2542ca9 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -384,12 +384,16 @@ static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t clus
>      return 0;
>  }
>  
> -static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks)
> +static int mkv_write_cues(AVIOContext *pb, int64_t *currentpos_ptr, mkv_cues *cues, int num_tracks)
>  {
>      ebml_master cues_element;
>      int64_t currentpos;
> +    int *track_has_cue;
>      int i, j;
>  
> +    if (!(track_has_cue = av_malloc(sizeof(int)*num_tracks)))
> +        return AVERROR(ENOMEM);

isnt it sikmpler to use a field in mkv_track instead of a dynamically
allocated array
?
would also avoid the return code changes

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130218/b89b1468/attachment.asc>


More information about the ffmpeg-devel mailing list