Structure of the RTP package

Source: Internet
Author: User

The data in the live555 is sent in the end to be sent using the RTP protocol, which describes the RTP package format.
RTP Packet

RTP is based on the UDP protocol, and the RTP server passes the UDP protocol, typically sending an RTP packet each time. The client reads the data and then plays it by parsing the RTP packet.

The structure of the RTP packet is as follows:

    1. The head of the RTP HEADER:RTP packet
    2. Contributing sources: The number is 0-n, so it can be empty. Specific definition Reference rfc3550
    3. RTP payload: That is, the data to be transferred by RTP
RTP Header

This is the head of the RTP stream, search the RTP format on the net, will search many articles to introduce this head definition. Here we refer to the definition of rfc3550, in verse 5.1 (http://tools.ietf.org/html/rfc3550#section-5.1).

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 |
| ....                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Each line is a count of bits, which gives you a visual view of the number of bits that each representation part occupies. Simply introduce:

V (Version): Version 2 BITS,RTP, here Unified for 2

P (padding): 1 bit, if set 1, is filled at the end of packet, padding is sometimes convenient for some packages for fixed-length algorithms

X (extension): 1 bit, if placed 1, the RTP header will follow a header extension

CC (CSRC count): 4 bits, indicating the number of contributing sources after the head

M (marker): 1 bit, specifically this definition will be in a profile

PT (playload type): 7 bits, indicating the type of multimedia being transmitted, the corresponding number is listed in another document RFC3551 (http://tools.ietf.org/html/rfc3551)

Sequence number:16 bits, sequence number per RTP packet is automatically added to the receiver to detect packet loss

Timestamp:32 bits, timestamp

Ssrc:32 bits, the ID of the synchronization source, the ID of no two sync sources cannot be the same

CSRC: As mentioned above, the number is specified by CC with a range of 0-15

RTP Packet

RTP is based on the UDP protocol, and the RTP server passes the UDP protocol, typically sending an RTP packet each time. The client reads the data and then plays it by parsing the RTP packet.

The structure of the RTP packet is as follows:

    1. The head of the RTP HEADER:RTP packet
    2. Contributing sources: The number is 0-n, so it can be empty. Specific definition Reference rfc3550
    3. RTP payload: That is, the data to be transferred by RTP
RTP Header

This is the head of the RTP stream, search the RTP format on the net, will search many articles to introduce this head definition. Here we refer to the definition of rfc3550, in verse 5.1 (http://tools.ietf.org/html/rfc3550#section-5.1).

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 |
| ....                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Each line is a count of bits, which gives you a visual view of the number of bits that each representation part occupies. Simply introduce:

V (Version): Version 2 BITS,RTP, here Unified for 2

P (padding): 1 bit, if set 1, is filled at the end of packet, padding is sometimes convenient for some packages for fixed-length algorithms

X (extension): 1 bit, if placed 1, the RTP header will follow a header extension

CC (CSRC count): 4 bits, indicating the number of contributing sources after the head

M (marker): 1 bit, specifically this definition will be in a profile

PT (playload type): 7 bits, indicating the type of multimedia being transmitted, the corresponding number is listed in another document RFC3551 (http://tools.ietf.org/html/rfc3551)

Sequence number:16 bits, sequence number per RTP packet is automatically added to the receiver to detect packet loss

Timestamp:32 bits, timestamp

Ssrc:32 bits, the ID of the synchronization source, the ID of no two sync sources cannot be the same

CSRC: As mentioned above, the number is specified by CC with a range of 0-15

Structure of the RTP package

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.