[FFmpeg-devel] What is missing for working AVFMT_FLAG_NONBLOCK?

Michael Niedermayer michaelni
Sun Jan 17 15:55:05 CET 2010


On Sun, Jan 17, 2010 at 03:45:32PM +0200, aviad rozenhek wrote:
> On Tue, Mar 3, 2009 at 04:06, Michael Niedermayer <michaelni at gmx.at> wrote:
> 
> > Hi
> >
> > AVFMT_FLAG_NONBLOCK is not enabled in ffmpeg/ffplay.c
> > what is missing for it?
> > capturing from several devices is likely going to work better if they
> > dont block. And yes i know it all should be using select() but that is
> > harder. And simple polling with non blocking demuxers should already
> > work pretty well.
> >
> > is the only thing missing the code in ffmpeg.c that picks files
> > based on the next expected timestamp?
> >
> > id like to set AVFMT_FLAG_NONBLOCK by default in ffmpeg.c
> >
> > --
> > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> >
> Hi,
> 
> what about udp.c and tcp.c? these could benefit from working in a
> non-blocking way too.
> attached patch that makes udp.c work in a non-blocking way.
> this fixes an annoyance that would make ffplay hang forever until killed:
> 
> running:
>   $> ffplay udp://localhost?localport=1234,
> without running any encoder that writes to udp://localhost:1234, the ffplay
> would hang until doing a hard kill, because it would be stuck in a loop
> inside udp.c

>  udp.c |   35 ++++++++++++++++-------------------
>  1 file changed, 16 insertions(+), 19 deletions(-)
> 6a37c865eeb54d684ff7072957066170155b00d5  non_blocking_udp.patch
> Index: libavformat/udp.c
> ===================================================================
> --- libavformat/udp.c	(revision 63272)
> +++ libavformat/udp.c	(working copy)
> @@ -468,27 +468,24 @@
>      int ret;
>      struct timeval tv;
>  
> -    for(;;) {
> -        if (url_interrupt_cb())
> -            return AVERROR(EINTR);
> -        FD_ZERO(&rfds);
> -        FD_SET(s->udp_fd, &rfds);
> -        tv.tv_sec = 0;
> -        tv.tv_usec = 100 * 1000;
> -        ret = select(s->udp_fd + 1, &rfds, NULL, NULL, &tv);
> -        if (ret < 0)
> +    if (url_interrupt_cb())
> +        return AVERROR(EINTR);
> +    FD_ZERO(&rfds);
> +    FD_SET(s->udp_fd, &rfds);
> +    tv.tv_sec = 0;

not reviewable, mixes cosmetics & functional changes

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

Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- 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/20100117/9828e802/attachment.pgp>



More information about the ffmpeg-devel mailing list