Sunday, October 13, 2019

How to calculate the actual RTP wall clock timestamp?

The packets arrived at different times, so their timestamps should be slightly different. But you use the difference between the NTP and RTP timestamps in the RTCP packets to determine the offset between RTP timestamps and the NTP time.


In Wireshark, you can see the "Timestamp, MSW" and "Timestamp, LSW" - these are the NTP timestamp at the time the RTCP packet was sent. You can also see the "RTP timestamp". Now, to determine the RTP offset, just shift the RTP timestamp left 16 bytes and then subtract from the NTP timestamp. Every RTP packet that comes later will have the RTP timestamp with the same offset from the NTP timestamp.
Here is the next RTP timestamp that I got in Wireshark after the RTCP packet shown above:


References:
https://github.com/bytedeco/javacpp-presets/issues/374

No comments:

Post a Comment