[FFmpeg-devel] [RFC] more intelligent EAGAIN handling in url_read_complete

Reimar Döffinger Reimar.Doeffinger
Sun Jan 24 16:01:14 CET 2010


On Sun, Jan 24, 2010 at 02:27:47PM +0100, Michael Niedermayer wrote:
> On Sun, Jan 24, 2010 at 11:51:38AM +0100, Reimar D?ffinger wrote:
> > not sure if this is overkill, but this improves EAGAIN handling
> > in url_read_complete:
> > It will retry reading in quick succession for the first 5 times
> > it receives EAGAIN and sleep if it still gets EAGAIN.
> > Each time some data is read successfully, it will increase the
> > counter to at least two fast retries.
> > The numbers (5 and 2) are rather arbitrary, though I think they
> > should be appropriate for fast handling of EAGAIN in case it happens
> > for some other reason than data not being ready while not using
> > insane amounts of CPU if the reads happen to be to some non-blocking source
> > (even though it does not usually make sense to use url_read_complete
> > on non-blocking sources).
> 
> >  avio.c |   10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 9ed8b459e37206b4a3f5b2463181e4687040f108  eagain.diff
> 
> do as you prefer, but i expect you to maintain the changed code if
> you commit this

Certainly, I am very much interested in how other people use it and how
to improve it or if they have problems with that behaviour.
I am currently doing the changes with MPlayer in mind, on the assumption
that other applications might have similar needs but a broader view is welcome.



More information about the ffmpeg-devel mailing list