What is the timestamp format in webrtc?

847 views
Skip to first unread message

yihungbakj hung

unread,
Aug 29, 2017, 3:09:28 AM8/29/17
to discuss-webrtc
Hi All

I want to know the time stamp formats in WebRTC. For example "cricket::VideoFrame::GetTimeStamp()"

Can anyone tell me what  is this format? (Unix timestamp or ntp timestamp)

Thank you.

yh

Niels Moller

unread,
Aug 29, 2017, 5:24:38 AM8/29/17
to discuss...@googlegroups.com
On Tue, Aug 29, 2017 at 9:09 AM, yihungbakj hung <yihun...@gmail.com> wrote:
> I want to know the time stamp formats in WebRTC.

There are multiple. The most important ones are system monotonic time,
corresponding to
clock_gettime(CLOCK_MONOTONIC,...) on posix systems, and the 90 kHz RTP clock
appearing in packets on the wire.

> For example
> "cricket::VideoFrame::GetTimeStamp()"

This method is obsolete and not included in current webrtc. See
https://cs.chromium.org/chromium/src/third_party/webrtc/api/video/video_frame.h?q=webrtc::VideoFrame&sq=package:chromium&dr=CSs&l=55
for current methods to access video frame timestamps.

Regards,
/Niels

yihungbakj hung

unread,
Aug 31, 2017, 12:17:33 AM8/31/17
to discuss...@googlegroups.com
Hi Niels

How to convert video frame timestamps to unix timestamps?

Thank you.

yh
yh


--

---
You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/7CZGfEF_kxk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/CAAO0x17kfY%3D-HfvsD6XG%2BxgT0AWZSUF7hOAjLcsJ1exLi2sXsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Niels Moller

unread,
Sep 5, 2017, 5:03:47 AM9/5/17
to discuss...@googlegroups.com
On Thu, Aug 31, 2017 at 6:17 AM, yihungbakj hung <yihun...@gmail.com> wrote:
> Hi Niels
>
> How to convert video frame timestamps to unix timestamps?

The easy case is if the frames also carry a valid ntp timestamp, ntp
time differs from unix time by a constant number of seconds.

To convert between monotonic time (rtc::TimeMicros, or
clock_gettime(CLOCK_MONOTONIC), and unix wall clock time like
gettimeofday, you would have to call both functions and compute the
offset.

At least on linux, they will run at the same frequency, controlled by
the ntp daemon, so the offset will be constant unless the system time
is changed by settimeofday. But in general, there may be some drift
between the two clocks.

I imagine that internally in the kernel, there's some offset used to
translate between monotonic time and gettimeofday; if you find any way
to access that offset, I'd like to know.

So it's a bit tricky. Don't do the conversion if there's any way you
can avoid it.

Regards,
/Niels
Reply all
Reply to author
Forward
0 new messages