[FFmpeg-devel] allocate enough memory for full audio frame in ffmpeg.c

Justin Ruggles justin.ruggles
Sun Jun 6 17:41:14 CEST 2010


Hi,

This patch fixes part of Issue 1921.

do_audio_out() in ffmpeg.c reads samples from the input to a FIFO until
it has enough for a full output frame, then reads from that FIFO to
audio_buf for encoding.  do_audio_out() is called for each input packet,
and the allocated size of audio_buf is based on each single packet.
However, it often takes multiple calls of do_audio_out() to fill the
FIFO enough to encode a single output frame, so sometimes audio_buf is
not large enough.  This patch ensures that audio_buf is large enough
before reading from the FIFO.

This still doesn't fix the FLAC encoder part of Issue 1921, but that is
a separate issue really.  The FLAC encoder is lazy and requires a large
output buffer instead of checking the remaining buffer size before every
write.

-Justin

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: audio_buf_size.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100606/e3f2a234/attachment.asc>



More information about the ffmpeg-devel mailing list