[FFmpeg-devel] [PATCH 1/2] Flush remaining frames from last packets

Jakub Stachowski qbast at go2.pl
Wed May 2 21:29:29 CEST 2012


W dniu 2012-05-02 21:15, Mashiat Sarker Shakkhar pisze:
> On 5/2/2012 11:59 PM, Jakub Stachowski wrote:
>> ---
>> libavcodec/wmalosslessdec.c | 5 ++++-
>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
>> index de5dca3..c1e5480 100644
>> --- a/libavcodec/wmalosslessdec.c
>> +++ b/libavcodec/wmalosslessdec.c
>> @@ -1173,7 +1173,10 @@ static int decode_packet(AVCodecContext *avctx,
>> void *data, int *got_frame_ptr,
>>
>> s->frame.nb_samples = 0;
>>
>> - if (s->packet_done || s->packet_loss) {
>> + if ( !buf&& s->num_saved_bits> get_bits_count(&s->gb)) {
>
> May be don't put a space after the (. Also leave one space before
> operator and one space after, that's enough.
>
>> + s->packet_done = 0;
>> + if (!decode_frame(s)) s->num_saved_bits = 0;
>
> I'd like this line to be broken into two.

Ok to above style fixes.

>
>> + } else if (s->packet_done || s->packet_loss) {
>> s->packet_done = 0;
>>
>> /* sanity check for the buffer length */
>
> To me it appears that this patch creates a special case for the last
> packet. Could you please explain why are you setting s->num_saved_bits
> to 0? i.e. what difference does it make? Correct me if I am wrong.

Because after decode_frame returns 0, there are still saved bits left. 
However if I continue to run decode_frame on those, it returns errors 
(like 'empty frame').

>
> Shakkhar
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



More information about the ffmpeg-devel mailing list