[FFmpeg-devel] [PATCH] Set the eof flag if a fskip call fails

Michael Niedermayer michaelni
Mon Jul 19 19:13:04 CEST 2010


On Mon, Jul 19, 2010 at 02:59:55PM +0300, Martin Storsj? wrote:
> On Mon, 19 Jul 2010, Michael Niedermayer wrote:
> 
> > On Mon, Jul 19, 2010 at 12:22:16PM +0300, Martin Storsj? wrote:
> > > Hi,
> > > 
> > > If the user called url_fskip and it failed, the read position of the 
> > > stream is not where the user intended it to be, and I think we can assume 
> > > that we hit eof. Thus, setting eof_reached = 1 seems logical to me.
> > 
> > how is this differernt from url_fseek() ?
> 
> I'd say, with fseek, one may be ready to fallback to not doing something 
> if the seek failed, but if fskip failed, we're probably at the end of the 
> stream, and need to take some action (stop reading), otherwise we're not 
> at least reading at the position we think we are.
> 
> I guess I should explain the initial reason for this. I recently debugged 
> a case where the flv demuxer went out of sync with the data it read, since 
> one of the url_fseek()s (that at that point used an ordinary low-level 
> http seek, just for skipping 4 bytes ahead) spuriously failed. This lead 
> to the demuxer suddenly returning garbage packets since it wasn't reading 
> at the offset it thought it was, since the seek had failed, but we weren't 
> yet at eof.
> 
> So, I'm just trying to add proper error checking at each level so noone 
> else will need to go through the same debugging session as I did.
> 
> Now we at least can notice failures from url_fskip since it returns an 
> error code, but instead of checking each of them, having them set the eof 
> flag would make the error handling much leaner, and it would fit into how 
> at least I conceptually see fskip.
> 
> Also, the short seek fix for aviobuf makes this issue almost completely go 
> away (since a short seek done by a read will trigger the eof flag).

is your reply somehow related to my question?

again, id like to know why fskip (which is nothing but a shorthand
form of fseek(cur)) should behave differently from fseek(cur)

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100719/9315503e/attachment.pgp>



More information about the ffmpeg-devel mailing list