calculating RTP delay at receiver side since the packet was sent from sender.

I am sending a video stream from the browser to gstreamer using webrtc. I can get the RTP time of the packets and NTP time from RTCP SR packets in gstreamer. At receiver I want to calculate the time elapsed since that packet was created at the sender.

You’d need signal from your production server (that handles producers) to tell end-point the time since started. The data could otherwise be inaccurate!

i am using direct peer to peer browser–> gstreamer
using webrtcbin element in gstreamer

previously I tried this with mediasoup browser–>mediaosup->gstreamer
but the NTP time in RTCP was incorrect .
came to know that mediasoup changes the RTP time and NTP time form here Forwarding NTP timestamp from source - #5 by oto313

Yeah you cannot use RTCP because it is hop to hop. ibc mentioned it in Forwarding NTP timestamp from source - mediasoup libraries - mediasoup

mediasoup does not relay RTCP packets, it consumes/terminates and produces its own ones as any proper SFU. RTCP protocol is hop by hop, not end to end. This is how things are and how things must be.

You can only get delay by one hop. I personally used RTP extension abs-capture-time to get the required delay

1 Like