public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] Monotonic clock usage in buffer timestamps
@ 2011-11-01 12:24 Laurent Pinchart
  2011-11-01 12:36 ` Rémi Denis-Courmont
  2011-11-02 10:04 ` Sakari Ailus
  0 siblings, 2 replies; 11+ messages in thread
From: Laurent Pinchart @ 2011-11-01 12:24 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: robert.swain

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-11-02 12:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-01 12:24 [RFC] Monotonic clock usage in buffer timestamps Laurent Pinchart
2011-11-01 12:36 ` Rémi Denis-Courmont
2011-11-01 12:49   ` Laurent Pinchart
2011-11-02  9:10     ` Daniel Glöckner
2011-11-02 10:14       ` Sakari Ailus
2011-11-02 10:51         ` Laurent Pinchart
2011-11-02 10:58         ` Daniel Glöckner
2011-11-02 11:16           ` Rémi Denis-Courmont
2011-11-02 12:47           ` Sakari Ailus
2011-11-02 12:32         ` Sakari Ailus
2011-11-02 10:04 ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox