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

Michael Niedermayer michaelni
Sun Dec 27 13:09:51 CET 2009


On Sun, Dec 27, 2009 at 12:31:38PM +0100, Reimar D?ffinger wrote:
> On Sun, Dec 27, 2009 at 12:11:39PM +0100, Stefano Sabatini wrote:
> >  static VideoState *global_video_state;
> > +static int64_t network_timeout_reference_time = 0;
> > +static int64_t network_timeout = INT64_MAX;
> >  
> >  static int decode_interrupt_cb(void)
> >  {
> > +    int64_t network_timeout_delta;
> > +
> > +    if (network_timeout_reference_time &&
> > +        (network_timeout_delta = (av_gettime() - network_timeout_reference_time) / 1000) > network_timeout) {
> 
> Please initialize network_timeout_delta at its declaration, this is
> really ugly like this.

yes but also make sure its inside the if() we dont need a av_gettime() call
if we arent checking timeouts


> I think it would also be a good idea to protect against the clock being
> reset by detecting av_gettime() < network_timeout_reference_time and
> adjusting network_timeout_reference_time.

why?
iam pretty sure ffmpeg will fail if the clock resets in 292
million years

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- 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/20091227/9be85534/attachment.pgp>



More information about the ffmpeg-devel mailing list