Re: [RFC] Monotonic clock usage in buffer timestamps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 01, 2011 at 01:24:35PM +0100, Laurent Pinchart wrote:
> Hi everybody,
> 
> The V4L2 specification documents the v4l2_buffer timestamp field as
> 
> "For input streams this is the system time (as returned by the gettimeofday() 
> function) when the first data byte was captured."
> 
> The system time is a pretty bad clock source to timestamp buffers, as it can 
> jump back and forth in time. Using a monotonic clock, as returned by 
> clock_gettime(CLOCK_MONOTONIC) (or ktime_get_ts() in the kernel), would be 
> much more useful.
> 
> Several drivers already use a monotonic clock instead of the system clock, 
> which currently violates the V4L2 specification. As those drivers do the right 
> thing from a technical point of view, I'd really hate "fixing" them by making 
> them use gettimeofday().
> 
> We should instead fix the V4L2 specification to mandate the use of a monotonic 
> clock (which could then also support hardware timestamps when they are 
> available). Would such a change be acceptable ?

I'm in favour of that. I don't think wall clock timestamps are really useful
to begin with. If you really need them, you can always do gettimeofday() in
the user space.

For any kind of a/v synchronisation where precise timestamps matter the
monotonic clock is the way to go.

Cheers,

-- 
Sakari Ailus
e-mail: sakari.ailus@xxxxxx	jabber/XMPP/Gmail: sailus@xxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux