[FFmpeg-devel] [PATCH] increase AVStream pts_buffer size

Måns Rullgård mans
Mon Aug 4 20:27:24 CEST 2008


Baptiste Coudurier <baptiste.coudurier at smartjog.com> writes:

> Hi,
>
> H264 decoder can (now?) set has_b_frames to MAX_DELAYED_PIC_COUNT which
> is 16, need to port this to pts_buffer in AVStream struct.
>
> compute_pkt_files in utils.c:
> int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames);
>
> [...]
>
> //calculate dts from pts
> if(pkt->pts != AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE){
>     st->pts_buffer[0]= pkt->pts;
>     for(i=1; i<delay+1 && st->pts_buffer[i] == AV_NOPTS_VALUE; i++)
>         st->pts_buffer[i]= (i-delay-1) * pkt->duration;
>     for(i=0; i<delay && st->pts_buffer[i] > st->pts_buffer[i+1]; i++)
>         FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i+1]);
>      pkt->dts= st->pts_buffer[0];
> }
>
> Patch attached.
>
> Index: libavformat/avformat.h
> ===================================================================
> --- libavformat/avformat.h	(revision 14513)
> +++ libavformat/avformat.h	(working copy)
> @@ -385,7 +385,7 @@
>  
>      int64_t nb_frames;                 ///< number of frames in this stream if known or 0
>  
> -#define MAX_REORDER_DELAY 4
> +#define MAX_REORDER_DELAY 16
>      int64_t pts_buffer[MAX_REORDER_DELAY+1];
>  
>      char *filename; /**< source filename of the stream */

This breaks ABI, so it needs a version bump.  Others can have an
opinion on how bad that is.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list