[RFC] Monotonic clock usage in buffer timestamps

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

 



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 ?

-- 
Regards,

Laurent Pinchart
--
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