[FFmpeg-devel] [PATCH 3/3] Non-blocking protocol: TCP

Martin Storsjö martin
Sun Feb 6 09:42:47 CET 2011

On Sat, 5 Feb 2011, Ronald S. Bultje wrote:

> Also, I know this has nothing to do with before your patch, but a
> quick grep shows:
> libavformat/rtsp.c:                        ret =
> url_read(rtsp_st->rtp_handle, buf, buf_size);
> libavformat/rtsp.c:        ret = url_read(in, recvbuf, sizeof(recvbuf));
> libavformat/sapdec.c:        ret = url_read(sap->ann_fd, recvbuf,
> sizeof(recvbuf) - 1);
> libavformat/sapdec.c:        ret = url_read(sap->ann_fd, recvbuf,
> sizeof(recvbuf));
> These seem ... questionable, and might need review. Particularly the
> one in the RTP punching code in rtsp.c is questionable and looks

Uhm, neither of these are in the RTP punching code, which resides in 

> unsafe/wrong. Is anyone interested in fixing these up and moving them
> up to url_read_complete() or otherwise making sure they are safe?

As Nicolas said, all of these read UDP packets. There, url_read() either 
returns one packet, or no data at all, there's nothing inbetween.

Also, since this patchset (afaik) only enables nonblocking reads where 
explicitly requested, there's no risk for the existing code (while some of 
these cases might be simplified once nonblocking reads are available).

Btw, it might be handy to be able to switch between blocking and 
nonblocking mode on URLContexts after creation, too. As far as I can see 
from the patches, this wouldn't be much harder than adding a function that 
sets/clears that bit in h->flags.

// Martin

More information about the ffmpeg-devel mailing list