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

Mashiat Sarker Shakkhar mashiat.sarker at gmail.com
Wed May 2 21:15:04 CEST 2012


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.

> +    } 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.

Shakkhar


More information about the ffmpeg-devel mailing list