Packet Structure of RTP

The structure of a RTP packet

**The structure of a RTP packet. e.g. Using UDP**
**rtp packet in wireshark**

The real-time media that is being transferred forms the 'RTP Payload'.
RTP header contains information related to the payload e.g. the source, size, encoding type etc.
However the RTP packet can't be transferred as it is over the network.
For transferring we use a transfer protocol called User Datagram Protocol (UDP).
To transfer the UDP packet over the IP network, we need to encapsulate it with a IP packet.

RTP Payload中存储着被传送的实时媒体数据.

RTP Header

Header Structure of RTP
Sequence Number

The sequence number increments by one for each RTP data packet sent, and may be used by the receiver to detect packet loss and to restore packet sequence.
The loss or out-of-order delivery occurs due network problems.

  • sequence number随着发送依次增长+1.
  • 可供receiver来判断是否有数据丢失.
Timestamp

timestamp: 32 bits

The timestamp reflects the sampling instant of the first octet(八位字节) in the RTP data packet.
The sampling instant must be derived from a clock that increments monotonically and linearly in time to allow synchronization and jitter calculations.

  • Timestamp: 该RTP包中第一个字节的采样时刻.
  • 时间戳有一个初始值,随着时间而不断增加.
  • 即使此时没有包被发出,时间戳也会不断增加.
  • 时间戳是实现去除抖动和实现同步必不可少的.
  • 需要注意的是timestamp的位数:32bit.

Several consecutive(连续的) RTP packets may have equal timestamps if they are (logically) generated at once, e.g., belong to the same video frame.
Consecutive RTP packets may contain timestamps that are not monotonic(无变化的) if the data is not transmitted in the order it was sampled, as in the case of MPEG interpolated video frames.
(The sequence numbers of the packets as transmitted will still be monotonic.)
So the sequence number is not enough for synchronization.
You already know that in a audio/video session audio and video data are transmitted using separate channels (if you don't know this, please go through applications of RTP).
The receiver matches the video data with corresponding audio data using timestamp.

  • 一些连续的RTP包可能拥有相同的时间戳, 因为他们属于同一帧.
  • 音频和视频数据是分别传输的.
  • 数据的接收者利用时间戳将视频和音频进行匹配.

References:
http://www.siptutorial.net/RTP/packetrtp.html
http://www.siptutorial.net/RTP/header.html
http://www.siptutorial.net/RTP/synchro.html
http://blog.csdn.net/ithzhang/article/details/38346557

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容