[FFmpeg-devel] [PATCH] RTSP-MS 15/15: move packet_time_start zero value assignment in asf.c

Michael Niedermayer michaelni
Thu Apr 16 05:13:36 CEST 2009


On Wed, Apr 15, 2009 at 09:36:47PM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Wed, Apr 15, 2009 at 6:24 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > so what you say is that the asf demuxer has a bug in relation to EOF handling
> > ?
> >
> > and you want to fix that?
> 
> Oh! This is a big can of worms and you knew it!

/me looks at the can from which beautifull butterflies emerge ;)



> 
> ASF files never reach EOF, they really do loop forever! This is a ASF
> packet header/data printf showing current pos / file size:
> 
> Reading ASF packet header at 13618013/13639000
> Parsing ASF packet data at 13618027/13639000
> Parsing ASF packet data at 13619531/13639000
> Parsing ASF packet data at 13621131/13639000
> Parsing ASF packet data at 13622622/13639000
> Parsing ASF packet data at 13624019/13639000
> Reading ASF packet header at 13624566/13639000
> Parsing ASF packet data at 13624580/13639000
> Parsing ASF packet data at 13626151/13639000
> Parsing ASF packet data at 13627647/13639000
> Reading ASF packet header at 13631119/13639000
> Parsing ASF packet data at 13631132/13639000
> Parsing ASF packet data at 13632630/13639000
> Parsing ASF packet data at 13637672/13639000
> [.. this is EOF! See below ..]
> Parsing ASF packet data at 13642714/13639000
> Parsing ASF packet data at 13647756/13639000
> Parsing ASF packet data at 13652798/13639000
> 
> At the "[.. see below ..]" point, every round of data reading consists
> just of trying to read the header, failing (because there's no data,
> all get_byte() and get_l/beXX() operations and such return 0) and thus
> calling url_fskip() to skip the data and try again. However,
> url_fskip() is broken in that it never sets eof_reached. It calls
> url_fseek(SEEK_CUR, skip_size);, which calls file_seek(), which calls
> lseek(2):
> 
>      "The lseek() function allows the file offset to be set beyond the end of
>      the existing end-of-file of the file."
> 

> Shit... I hate you. :-).

good :)


> The only calls that ever set eof_reached()
> for regular files are get_buffer() or fill_buffer(), neither of which
> are used in asfdec.c, at least not as long as all calls to
> get_byte()/get_l/beXX() return 0. Any suggested way of fixing this?...

moment, how can get_anything return anything without
a fill_buffer() ?
yes, url_fseek/skip() clears eof but the first get_byte() or whatever
will notice it has no data and call fill_buffer() that will set eof_reached
again, so unless you check for eof straight after a url_fskip/seek it should
give the correct value



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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090416/0c1b82b6/attachment.pgp>



More information about the ffmpeg-devel mailing list