[FFmpeg-devel] [PATCH 07/28] changed: check return value of seeks to avoid messing up current stream location

Joakim Plate elupus
Wed Jun 30 19:22:46 CEST 2010

Reimar D?ffinger <Reimar.Doeffinger <at> gmx.de> writes:

> >              pos = url_ftell(pb);
> >  
> > -            url_fseek(pb, offset+8, SEEK_SET);
> > +            if(url_fseek(pb, pos, SEEK_SET) < 0) {
> > +                av_log(s, AV_LOG_ERROR, "Failed to restore position after 
reading index");
> > +                return -1;
> > +            }
> when/why does this make a difference?

By the looks of it, the error message is wrong. If the stream is not seekable
and you keep on reading the braindead index, you have changed the stream
position and can't restore it (and the braindead index you read is wrong).
While if you bail on the failed seek, you can continue parsing other things
in the stream. (This is going by memory, not looking at the surrounding code)


More information about the ffmpeg-devel mailing list