[Ffmpeg-devel] Bug in pts computation in compute_pkt_fields() ?

Wolfram Gloger wmglo
Sat Mar 24 14:03:22 CET 2007


> > cur_dts must never become negative..
> 
> why?

Well, e.g. because truncate_ts fails for negative dts:

static void truncate_ts(AVStream *st, AVPacket *pkt){
    int64_t pts_mask = (2LL << (st->pts_wrap_bits-1)) - 1;

    //if(pkt->dts < 0)
    //    pkt->dts= 0;  //this happens for low_delay=0 and b frames, FIXME, needs further invstigation about what we should do here

    if (pkt->pts != AV_NOPTS_VALUE)
        pkt->pts &= pts_mask;
    if (pkt->dts != AV_NOPTS_VALUE)
        pkt->dts &= pts_mask;
}

So, if negative dts is allowed, at least the two lines above need to
be uncommented, no?  Or some better solution must be found.

Background: I'm now seeing errors even in "make test" for the mpeg-ts
muxer; some packets' dts becomes negative due to the new code in
libavformat/utils.c (your recent changes), truncate_ts makes a huge
_positive_ value out of this, ffmpeg.c computes a corresponding huge
vdelta, and duplicates frames until out of memory... (OOM in
interleaver_per_dts, because only a single video frame is holding up
everything)

Regards,
Wolfram.




More information about the ffmpeg-devel mailing list