[FFmpeg-devel] [RFC] url_write()
Martin Storsjö
martin
Thu Sep 30 17:14:34 CEST 2010
On Thu, 30 Sep 2010, Stefano Sabatini wrote:
> On date Thursday 2010-09-30 13:20:33 +0200, Michael Niedermayer encoded:
> > Hi
> >
> > While reviewing one of stefanos doxymentation patches and cross checking
> > it against the code. Ive realized that apparently url_write() uses dont
> > consider the case of fewer bytes being written with success
> > and
> > our protocols do seem able to succeed with fewer bytes written
> >
> > What do users of url_write() prefer
> > should we always call it in a loop in the url_write() wraper or
> > should all uses be fixed and a url_write_complete() be added similar to
> > url_read()
> > ?
>
> Is there some meaningful use of the url_write() in the non-complete
> form?
>
> Is there, for analogy, some meaningful use of the url_read() in the
> non-complete form?
>
> libavformat mostly use url_read_complete(), but there are some cases
> where url_read() is preferred.
Yes, for url_read(), it makes very much sense to return as soon as 1 byte
or more is available. One concrete example is the flv demuxer used with
ByteIOContext and RTMP - once the ByteIOContext is empty, the next read at
that level calls fill_buffer(), and if the RTMP protocol handler only
returns until all the requested data is available, it will block for a
long time (around a second or so, depending on bitrate and whatnot),
giving a huge latency, when the data for the next packet already is
available.
For url_write() I'm undecided though, I don't have too much an opinion on
which way it goes, as long as it is properly documented and consistently
used.
// Martin
More information about the ffmpeg-devel
mailing list