[FFmpeg-devel] [PATCH] ffmpeg.c : do not reset frame size after encoding small last frame

Michael Niedermayer michaelni
Thu Apr 16 05:23:23 CEST 2009


On Wed, Apr 15, 2009 at 11:11:35PM -0400, Justin Ruggles wrote:
> Hi,
> 
> This patch removes the save/restore of the previous enc->frame_size
> before and after writing a small last frame.
> 
> This makes the value correct when writing the last packet.  The muxer
> should not assume this value to be constant during encoding, so should
> not use it if rewriting the header during write_trailer().  The FLAC
> muxer did this, but I fixed it earlier today.
> 
> As a result, the recent addition by Baptiste to calculate the packet
> duration for the small last frame is not needed since it will be
> correctly calculated by lavf if enc->frame_size is correct.

iam not in favor of this patch, frame_size is the only means by which a
muxer knows the size of frames (except the last) if it is constant.
making this value unreliable would mean odd bugs and muxers requireing to
cache its value at the begin.
AVPacket.duration is the one and correct place to indicate the current
packets duration, a value in the context is not a good choice, packets
can be buffered at many places, the stream interleaving code is just
one and given that the value written in there by the app(ffmpeg) may
not match the packet the demuxer is actually writing next

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

It is not what we do, but why we do it that matters.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090416/70482561/attachment.pgp>



More information about the ffmpeg-devel mailing list