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

Baptiste Coudurier baptiste.coudurier
Sat May 23 06:07:45 CEST 2009


Michael Niedermayer wrote:
> 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
> 

Sure, changed and applied.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list