RTP包頭前12個固定字節機構圖:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P|X| CC |M| PT | sequence number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| timestamp |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| synchronization source (SSRC) identifier |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| contributing source (CSRC) identifiers |
| …. |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- V – Version. Identifies the RTP version.
- RTP版本號
- P – Padding. When set, the packet contains one or more additional padding octets at the end which are not part of the payload.
- 是否填充,如果設置為允許填充的話,在包的末尾填充一個或多個字節,這些填充的字節不是有效負載的一部分。
- X – Extension bit. When set, the fixed header is followed by exactly one header extension, with a defined format.
- 擴充位,如果設置為允許的話,固定頭結構后面(即包的12個字節后面,有效負載的前面)緊跟着一個擴展頭結構,該結構是已定義的一種格式
- CSRC count (CC) -Contains the number of CSRC identifiers that follow the fixed header.
- 數據源的個數(即源的個數),如果只有一個源那么此時的值為0。
- M – Marker. The interpretation of the marker is defined by a profile. It is intended to allow significant events such as frame boundaries to be marked in the packet stream.
- 標識,在文檔中是這樣定義的,它有意標識重要的事物比如:在流媒體中標識一幀數據的邊界(結束或開始)。
- Payload type – Identifies the format of the RTP payload and determines its interpretation by the application. A profile specifies a default static mapping of payload type codes to payload formats. Additional payload type codes may be defined dynamically through non-RTP means.
- 有效負載,RTP數據的有效負載(不包括頭12個字節),由具體的應用程序來確定負載的格式和意義。官方文檔里有表格說明,該表格顯示了格式代碼和具體格式的對應關系,附加的格式代碼可能不在RTP協議里定義。
- 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.
- 數據包序號,發送的RTP數據包序號,接收端可用它來檢查丟失的數據包和確定保存數據包次序。
- 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.
- 時間戳, 紀錄了RTP數據包中第一個字節的采樣時間,采樣時間必須源自一個時間增量且允許同步和計算。
- SSRC – Synchronization source. This identifier is chosen randomly, with the intent that no two synchronization sources within the same RTP session will have the same SSRC identifier.
- 同步標識, 是一個隨機數,在同一個RTP會話中只有一個同步標識。
- CSRC – Contributing source identifiers list. Identifies the contributing sources for the payload contained in this packet.