[FFmpeg-devel] Spurious delay between DTS and PTS

Michael Niedermayer michaelni at gmx.at
Fri Sep 14 02:37:46 CEST 2012


On Tue, Sep 11, 2012 at 01:52:30PM -0700, C Chatterjee wrote:
> 
> I found an issue with the bf parameter initialization and associated problems.
> 
> bf (libx264 bframes) parameter is initialized to -1 in libavcodec/libx264.c as below:
> static const AVCodecDefault x264_defaults[] = {
>     { "b",                "0" },
>     { "bf",               "-1" },
> 
> bf is then used to initialize AvCodecContext::max_b_frames in:
> int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
>     .....
>     if (codec && codec->defaults) {
>         int ret;
>         const AVCodecDefault *d = codec->defaults;
>         while (d->key) {
>             ret = av_opt_set(s, d->key, d->value, 0);
>             av_assert0(ret >= 0);
>             d++;
>         }
>     }
>     return 0;
> }
> 
> max_b_frames is later used in libavformat/utils.c as:
> static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){
>     int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames);
> 
> If max_b_frames==-1 ie uninitialized, the above line will produce delay=1 which will create a latency delay between dts and pts which is unnecessary for say baseline H.264 sequences.

should be fixed

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

Avoid a single point of failure, be that a person or equipment.
-------------- 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/20120914/b0e051b0/attachment.asc>


More information about the ffmpeg-devel mailing list