[FFmpeg-devel] [PATCH] add timeout to udp_read

Stefano Sabatini stefano.sabatini-lala
Sun Dec 27 12:11:39 CET 2009


On date Sunday 2009-12-27 04:13:31 +0100, Michael Niedermayer encoded:
> On Fri, Dec 25, 2009 at 10:28:11PM +0100, Stefano Sabatini wrote:
> > On date Monday 2009-11-16 01:18:08 +0100, Michael Niedermayer encoded:
> > > On Mon, Nov 16, 2009 at 01:00:57AM +0100, Stefano Sabatini wrote:
> > > [...]
> > > > Please make more clear this sentence.
> > > 
> > > Please, more clear this sentance make as well.
> > 
> > Patch updated, with some namespace / docs clarification added.
[...]
> > Index: ffmpeg/ffplay.c
> > ===================================================================
> > --- ffmpeg.orig/ffplay.c	2009-12-25 21:25:26.000000000 +0100
> > +++ ffmpeg/ffplay.c	2009-12-25 22:26:13.000000000 +0100
> > @@ -1866,9 +1866,19 @@
> >  /* since we have only one decoding thread, we can use a global
> >     variable instead of a thread local variable */
> >  static VideoState *global_video_state;
> > +static int64_t nto_reference_time = 0;
> 
> > +static int64_t nto = INT64_MAX;
> 
> please dont name  global variables like this
> instead use a descriptive name that is made of things that one can find
> in a english dictionary

Done.

> 
> [...]
> > @@ -2454,6 +2466,13 @@
> >      return 0;
> >  }
> >  
> > +static int opt_nto(const char *opt, const char *arg)
> > +{
> > +    /* reduced max boundary due to the precision of double at INT64_MAX */
> > +    nto = parse_number_or_die(opt, arg, OPT_INT64, 0, INT64_MAX - 20000);
> > +    return 0;

What about to split parse_number_or_die() -> parse_{integer,double}_or_die()?

This should avoid these difficult to manage cases (and I'm quite sure
we skipped these rounding considerations when using the function in
other points).

> > +}
> > +
> >  static const OptionDef options[] = {
> >  #include "cmdutils_common_opts.h"
> >      { "x", HAS_ARG | OPT_FUNC2, {(void*)opt_width}, "force displayed width", "width" },
> > @@ -2486,6 +2505,7 @@
> >      { "ec", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_concealment}, "set error concealment options",  "bit_mask" },
> >      { "sync", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
> >      { "threads", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
> > +    { "nto", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)&opt_nto}, "set network timeout in milliseconds, used when opening a network stream", "timeout" },
> >      { "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
> >      { NULL, },
> >  };
> 
> this stuff belongs in common code hmm didnt i say that alraedy?

No. Also I have no idea how to adapt the function for ffmpeg /
ffserver.

Regards.
-- 
FFmpeg = Furious and Frightening Merciless Purposeless Empowered Game
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implement-ffplay-nto-opt.patch
Type: text/x-diff
Size: 3137 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091227/e6154d44/attachment.patch>



More information about the ffmpeg-devel mailing list