[FFmpeg-devel] [PATCH] pad last audio frame when encoding

Michael Niedermayer michaelni
Sat May 23 03:36:52 CEST 2009


On Fri, May 22, 2009 at 05:43:59PM -0700, Baptiste Coudurier wrote:
> Hi,
> 
> $subject, to avoid losing samples from source, currently stream in truncated.
> 
> -- 
> Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
> Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
> FFmpeg maintainer                                  http://www.ffmpeg.org

>  ffmpeg.c                     |   13 +++++++-
>  tests/data/vsynth.regression |   66 +++++++++++++++++++++----------------------
>  2 files changed, 44 insertions(+), 35 deletions(-)
> 57e0f1e13a436571543baa1c7524b9e6d8975cde  pad_last_audio_frame.patch
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 18890)
> +++ ffmpeg.c	(working copy)
> @@ -1463,11 +1463,20 @@
>                              fifo_bytes = av_fifo_size(ost->fifo);
>                              ret = 0;
>                              /* encode any samples remaining in fifo */
> -                            if(fifo_bytes > 0 && enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
> +                            if (fifo_bytes > 0) {
>                                  int osize = av_get_bits_per_sample_format(enc->sample_fmt) >> 3;
>                                  int fs_tmp = enc->frame_size;
> -                                enc->frame_size = fifo_bytes / (osize * enc->channels);
> +
>                                  av_fifo_generic_read(ost->fifo, samples, fifo_bytes, NULL);
> +                                if (enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME)
> +                                    enc->frame_size = fifo_bytes / (osize * enc->channels);
> +                                else { /* pad */

if(){
    ^
}else
^

are better for compactness of future patches

except that looks ok

[...]
-- 
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: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090523/582e7b3b/attachment.pgp>



More information about the ffmpeg-devel mailing list