[FFmpeg-devel] [PATCH] Fix return value for incomplete H264 frame packets

Pásztor Szilárd don
Wed Aug 25 22:11:14 CEST 2010


Michael Niedermayer:
> The packet you get from the demuxer/parser has a pts, dts
> and a duration
> they tell you when to feed it in the decoder, when it will
> be dislpayed to the end user and for how long.

Not if you ignore pts in packets and do your own frametime
based calculation. It is useful for:
1. forcing a different frame rate
2. more importantly, many streams have bogus timestamps,
just look at this one:
http://www.sundtek.de/support/danish_dvb.ts

Try it with ffplay...
But once you decide to drop pts and calculate it yourself,
you need more info from lavc. See below.

> the problem either is there or in you not describing what
> your problem is

Ok then I summarize:
* If the decoder returns no error and no picture for a packet,
it usually means "frame not completed, give me more data" in
case of h264, where the player should call the decoder again.
* other decoders may return no picture and no error for a
different reason (mpeg4 non-coded vop, etc.), where the player
should wait one frame duration regardless.
* once the generic function avctx->codec->decode() returns,
this possible difference is lost. The only point where this
h264 "special case" info is yet available is in h264.c.
* this information is needed for the player to make a proper
time-based pts recalculation. It must know if it has to wait
or decode the next packet immediately.

What I'd like to achieve is to export this tiny bit of info
at the appropriate point. In my latest patch it is set as
one flag among many more possible ones. I don't know what to
do with those other possibilites because I don't know if other
info is needed for anyone to be exported (I just added what
Reimar suggested, supposing he knows more than me what to do
with them). But regardless, this patch just adds a small
feature and is 100% backwards compatible.

And you said you have no problem with a clean patch that
exports such information. That's why I sent a clean patch that
exports such information. It does not harm anyone, and does
not kill your cat.

And the repeat_pict flag is of absolutely no use here.



More information about the ffmpeg-devel mailing list