[FFmpeg-devel] [PATCH v3] lavu: add av_gettime_relative() and use it.

Michael Niedermayer michaelni at gmx.at
Sat May 3 00:17:30 CEST 2014


On Thu, May 01, 2014 at 06:18:46PM -0400, Olivier Langlois wrote:
> Also add similar av_usleep_relative().
> 
> This is third version of the patch that accounts for Nicolas George comments.
> 
> These functions are using the POSIX clock_gettime() function with the
> CLOCK_MONOTONIC clock id. If these are not present on the targeted
> platform, the new functions will fallback on using the original realtime functions
> av_gettime() and av_usleep().
> 
> Monotonic support can be added on other platforms with their
> equivalent native system API eventually if possible.
> 
> Whenever time is requested to measure relative time, the monotonic clock,
> when available, is superior to the system realtime clock because it is
> not affected by discontinuous jumps in the system time
> 
> In a future step, offering the flexibility to let the user choose between
> rt and monotonic clock for avdevices packets will be investigated.
> 
> It is very easy to experience the issues that this patch attempt to address
> by rewinding back in the past the system time while ffmpeg is running.
> 
> this is breaking the ffmpeg report printing (ffmepg.c:print_report()) and
> the the rate emulator functionality (-re) without the patch.
> 
> Signed-off-by: Olivier Langlois <olivier at trillion01.com>
> ---
>  cmdutils_opencl.c        |  4 ++--
>  configure                |  2 ++
>  ffmpeg.c                 | 10 +++++-----
>  ffplay.c                 | 26 +++++++++++++-------------
>  libavcodec/dct-test.c    |  8 ++++----
>  libavcodec/fft-test.c    |  4 ++--
>  libavcodec/motion-test.c |  4 ++--
>  libavdevice/v4l2.c       | 14 ++------------
>  libavformat/avio.c       |  4 ++--
>  libavformat/network.c    |  4 ++--
>  libavformat/sapenc.c     |  2 +-
>  libavutil/time.c         | 41 ++++++++++++++++++++++++++++++++++++++++-
>  libavutil/time.h         | 28 ++++++++++++++++++++++++++++
>  tools/aviocat.c          |  6 +++---
>  14 files changed, 108 insertions(+), 49 deletions(-)

maybe this should be split in a patch that adds and documents the
new stuff
and a seperate one which switches things to it, or possibly one could
split it more

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

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140503/c266044d/attachment.asc>


More information about the ffmpeg-devel mailing list