[FFmpeg-cvslog] r22389 - trunk/libavformat/bink.c

Vitor Sessak vitor1001
Tue Mar 9 14:12:09 CET 2010


pross wrote:
> Author: pross
> Date: Tue Mar  9 13:32:08 2010
> New Revision: 22389
> 
> Log:
> Ensure Bink demuxer returns AVERROR code when av_get_packet() fails
> 
> Modified:
>    trunk/libavformat/bink.c
> 
> Modified: trunk/libavformat/bink.c
> ==============================================================================
> --- trunk/libavformat/bink.c	Tue Mar  9 13:09:55 2010	(r22388)
> +++ trunk/libavformat/bink.c	Tue Mar  9 13:32:08 2010	(r22389)
> @@ -212,8 +212,8 @@ static int read_packet(AVFormatContext *
>          bink->current_track++;
>          if (audio_size >= 4) {
>              /* get one audio packet per track */
> -            if ((ret = av_get_packet(pb, pkt, audio_size)) <= 0)
> -                return ret;
> +            if ((ret = av_get_packet(pb, pkt, audio_size)) != audio_size)
> +                return ret < 0 ? ret : AVERROR(EIO);;

I think the prefered behavior in FFmpeg is to pass incomplete packets to 
the decoder and let it handle them as it was before the patch. This is 
also a memleak.

>              pkt->stream_index = bink->current_track;
>              pkt->pts = bink->audio_pts[bink->current_track - 1];
>  
> @@ -230,7 +230,7 @@ static int read_packet(AVFormatContext *
>      /* get video packet */
>      if ((ret = av_get_packet(pb, pkt, bink->remain_packet_size))
>                                     != bink->remain_packet_size)
> -        return ret;
> +        return ret < 0 ? ret : AVERROR(EIO);

Same thing here, one should check only ret < 0.

-Vitor



More information about the ffmpeg-cvslog mailing list