webrtc-rs/rtp

Are `Packet.header.timestamp` values raw or transformed?

Closed this issue · 1 comments

I have a live media streaming server that currently works with RTMP, and I'm adding support for WebRTC to be interleaved within RTMP workflows (e.g. Webrtc input, generate HLS, then push out to a RTMP server). Thus I need to know the true pts of each h264 packet I receive in order to make sure I pass the correct timestamps down the workflows.

So my code currently is calling TrackRemote.read_rtp() to get the RTP packet, then passing it into a custom h264 handler that's based off of the h264_writer code. The only timestamp I can see getting is rtp_packet.header.timestamp, but the RTP spec (or docs I've read) says that the timestamps specified in RTP packets start from a random timestamp, and thus need to be adjusted based on an epoch specified in the rtcp session.

There's not much documentation so I'm having trouble determining the answer to this, but are the rtp_packet.header.timestamp values raw values from the RTP packet, or are they already adjusted based on the rtcp session offset?

If they are raw, what's the solution to getting a reliable PTS for each packet?

Nevermind, I understand now.

The packet.header.timestamp values are raw, since the packet doesn't know the sampling rate that should be used to adjust them. Thus timestamp calculations have to be manually done.