[FFmpeg-devel] [PATCH] lavfi: add realtime filter.

Nicolas George george at nsup.org
Mon Oct 26 21:51:21 CET 2015


Le quartidi 4 brumaire, an CCXXIV, Mark Harris a écrit :
> > +        if (sleep > s->limit || sleep < -s->limit) {
> > +            av_log(ctx, AV_LOG_WARNING,
> > +                   "time discontinuity detected: %"PRIi64" us, resetting\n",
> > +                   sleep);
> Won't this also be shown when there is no discontinuity but it isn't
> able to keep up with realtime (e.g. due to a very high frame rate)?
> The message is misleading in that situation.

This is true, but I consider it an acceptable approximation for now. I am
sure any user would guess what it means if the CPU is permanently at 100%
and this warning is printed repeatedly. An heuristic could be added to
detect when processing is slower than realtime and print a warning
accordingly, but tuning it would require more time than I want to spend on
this right now.

> The argument to av_usleep() is an unsigned int.  Should the maximum
> limit be UINT_MAX rather than INT64_MAX?  Alternatively it could call
> av_usleep() in a loop if the value is too large for one call.

Good catch, although it would probably not matter in practice: that would
involve a >1 hour gap between frames, the user actually wanting to sleep for
that time and having set the limit accordingly. But all the same, I added
this locally:

+            for (; sleep > 600000000; sleep -= 600000000)
+                av_usleep(600000000);

(I used 600000000 instead of UINT_MAX because I do not trust values too near
the limit value for that kind of system call; a spurious wakeup every
10 minutes is acceptable. Also, it will probably be easier to guess what it
means when reading strace output.)

Thanks for the review.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151026/bf5ede1d/attachment.sig>


More information about the ffmpeg-devel mailing list