[FFmpeg-devel] [PATCH] stop av_find_stream_info after reading a certain amount of frames

Michael Niedermayer michaelni
Mon Mar 2 15:25:19 CET 2009


On Mon, Mar 02, 2009 at 03:19:04PM +0100, Michael Niedermayer wrote:
> On Sun, Mar 01, 2009 at 08:43:25PM -0800, Baptiste Coudurier wrote:
> > Baptiste Coudurier wrote:
> > > Marc Mason wrote:
> > >> Baptiste Coudurier wrote:
> > >>
> > >>> Index: libavformat/utils.c
> > >>> ===================================================================
> > >>> --- libavformat/utils.c	(revision 17505)
> > >>> +++ libavformat/utils.c	(working copy)
> > >>> @@ -2019,7 +2019,7 @@
> > >>>  
> > >>>      count = 0;
> > >>>      read_size = 0;
> > >>> -    for(;;) {
> > >>> +    for(; count < 200; ) {
> > >> Just wondering. Why not "while (count < 200)" ?
> > > 
> > > Yes, why not.
> > > 
> > 
> > Michael, can you please comment and propose a better solution if you see
> > one.
> 
> limiting the loop to 200 iterations wil cause regressions, iam sure of that
> but i cant point to some file.
> I just know there are files where one stream starts later then the other and
> 200 isnt all that much
> 
> 
> > 
> > It seems EAGAIN thing broke FFserver, since there is an infinite loop in
> > av_find_stream_info.
> 
> what about a solution like:
> if(ret == AVERROR(EAGAIN) && strcmp(is->iformat->name, "ffm"))
>     continue;
> as we have in ffmpeg.c
> ?

other options would be useig url_interrupt_cb() in ffserver.c
or making ffm return AVERROR_EOF when it reaches EOF instead of EAGAIN
or making av_find_stream_info() return EAGAIN itself immedeatly but
this is hardest as we would need to store all context to allow continuation
also this one would break all user apps but it is technically most correct
behavior IMHO

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- 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/20090302/6ad80dde/attachment.pgp>



More information about the ffmpeg-devel mailing list