mediacapture-transform icon indicating copy to clipboard operation
mediacapture-transform copied to clipboard

What is the timestamp value of the VideoFrame/AudioData from a remote track?

Open murillo128 opened this issue 2 years ago • 4 comments

I have not been able to find if there is any specification about what is the value of the timestamp attribute of an VideoFrame or AudioFrame from a remote MediaStreamTrack recevied by a webrtc peerconnection.

Is is specified anywhere?

murillo128 avatar Oct 20 '22 09:10 murillo128

Interestingly, this has come up in other contexts today. I think we need to find an answer (preferably a consistent one). Have you observed this value in the current state of implementation?

alvestrand avatar Oct 20 '22 13:10 alvestrand

It seems that it is using the elapsed time since the first received frame (i.e. relative timestamp since the beginning of the call, starting at 0)

https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/webrtc/convert_to_webrtc_video_frame_buffer.cc;drc=047c7dc4ee1ce908d7fea38ca063fa2f80f92c77;l=347

https://jsfiddle.net/ytqn98eb/

murillo128 avatar Oct 24 '22 08:10 murillo128

This is being discussed in https://github.com/w3c/mediacapture-transform/issues/96. It seems good to me for each spec defining a track source to define how to extract a VideoFrame from it.

As of webrtc video frames, the closest I could get is the definition of captureTime: For video frames coming from remote source, the capture time is based on the RTP timestamp of the frame and estimated using clock synchronization. This is best effort and can use methods like using RTCP SR as specified in RFC 3550 Section 6.4.1, or by other alternative means if use by RTCP SR isn’t feasible.

youennf avatar Sep 19 '24 12:09 youennf