[FFmpeg-devel] [PATCH 1/6] lavu: add av_gettime_relative()
LANGLOIS Olivier PIS -EXT
olivier.pis.langlois at transport.alstom.com
Thu May 8 00:47:37 CEST 2014
> > configure | 2 ++
> > libavdevice/v4l2.c | 14 ++------------
> > libavutil/time.c | 31 ++++++++++++++++++++++++++++++-
> > libavutil/time.h | 15 +++++++++++++++
> > 4 files changed, 49 insertions(+), 13 deletions(-)
>
> Did you want to keep the lavd change with the lavu change? I suppose they
> used to conflict, but they no longer do.
Yes. that was on purpose. While it is true that the function av_gettime_monotonic() from lavd does not conflict anymore since we renamed the function in lavu, they are still essentially identical so in order to avoid unnecessary code replication, I have made v4l2 use the new lavu function as in previous versions of the patch. One could argue that since the function av_gettime_relative() may not always be implemented as monotonic, in order to avoid a possible maintenance glitch in case that theoretically av_gettime_relative() on Linux would stop being identical to v4l2's av_gettime_monotonic(), it would be better to leave v4l2.c as is.
If that is what you have in mind, I can drop these changes. Just let me know if I read your comment correctly.
>
> >
> > diff --git a/configure b/configure
> > index e5ff72b..656ae3d 100755
> > --- a/configure
> > +++ b/configure
> > @@ -1659,6 +1659,7 @@ SYSTEM_FUNCS="
> > access
> > aligned_malloc
> > clock_gettime
>
> > + clock_nanosleep
>
> Seems not useful anymore.
Correct
>
> > closesocket
> > CommandLineToArgvW
> > CoTaskMemFree
> > @@ -4489,6 +4490,7 @@ check_func ${malloc_prefix}posix_memalign
> && enable posix_memalign
> >
> > check_func access
> > check_func clock_gettime || { check_func clock_gettime -lrt &&
> > add_extralibs -lrt; }
>
> > +check_func clock_nanosleep || { check_func clock_nanosleep &&
> > +add_extralibs -lrt; }
>
> Ditto.
I agree again
> > --- a/libavutil/time.c
> > +++ b/libavutil/time.c
> > @@ -38,7 +38,15 @@
> >
> > int64_t av_gettime(void)
> > {
> > -#if HAVE_GETTIMEOFDAY
>
> > +#if HAVE_CLOCK_GETTIME
> > + /*
> > + * POSIX.1-2008 marks gettimeofday() as obsolete,
> > + * recommending the use of clock_gettime(2) instead.
> > + */
> > + struct timespec ts;
> > + clock_gettime(CLOCK_REALTIME, &ts);
> > + return (int64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000; #elif
> > +HAVE_GETTIMEOFDAY
>
> I really think this is unnecessary: gettimeofday() is not going away anytime
> soon, so this would just be more code in FFmpeg for no benefit.
>
No problem.
thank you for your comments Nicolas.
regards,
Olivier
Please ignore the confidentiality notice below.
It is automatically added without my consent.
________________________________
CONFIDENTIALITY : This e-mail and any attachments are confidential and may be privileged. If you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose or store or copy the information in any medium.
More information about the ffmpeg-devel
mailing list