On Tue, Nov 17, 2015 at 05:39:31PM -0500, Ganesh Ajjanagadde wrote:
> ffio_ensure_seekback can fail due to e.g ENOMEM. This return value is
> checked here and a diagnostic is logged.
> 
> All usage of ffio_ensure_seekback in the codebase now has the return value 
> checked.
> 
> Signed-off-by: Ganesh Ajjanagadde <gajjanaga...@gmail.com>
> ---
>  libavformat/mp3dec.c | 6 ++++--
>  libavformat/rmdec.c  | 3 ++-
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
> index 32ca00c..a14bccd 100644
> --- a/libavformat/mp3dec.c
> +++ b/libavformat/mp3dec.c
> @@ -380,11 +380,13 @@ static int mp3_read_header(AVFormatContext *s)
>          uint32_t header, header2;
>          int frame_size;
>          if (!(i&1023))
> -            ffio_ensure_seekback(s->pb, i + 1024 + 4);
> +            if ((ret = ffio_ensure_seekback(s->pb, i + 1024 + 4)) < 0)
> +                av_log(s, AV_LOG_WARNING, "ffio_ensure_seekback(): %s\n", 
> av_err2str(ret));
>          frame_size = check(s->pb, off + i, &header);
>          if (frame_size > 0) {
>              avio_seek(s->pb, off, SEEK_SET);
> -            ffio_ensure_seekback(s->pb, i + 1024 + frame_size + 4);
> +            if ((ret = ffio_ensure_seekback(s->pb, i + 1024 + frame_size + 
> 4)) < 0)
> +                av_log(s, AV_LOG_WARNING, "ffio_ensure_seekback(): %s\n", 
> av_err2str(ret));
>              if (check(s->pb, off + i + frame_size, &header2) >= 0 &&
>                  (header & SAME_HEADER_MASK) == (header2 & SAME_HEADER_MASK))
>              {

it is probably better to also break out of the loop if these fail

and as a message yu could use something like
initial junk detection and skiping not possible due to <error>

[....]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to