RTP message format, various parameter meanings, encoding rate calculation

Source: Internet
Author: User
Tags pack
1 RTP Message Format

The RTP message format is as follows, see RFC1889 (most audio visual coding formats are consistent, some changes are shown in various coded RTP protocols):

A. RTP Header format Simple introduction

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 version number, 2;

P:padding, whether the net charge is filled, when used for encryption;

x:extension, extension bit, whether the fixed head follows the extension header;

Number of CC:CSRC, indicating the number of contribution source identifiers traced back;

M:marker, flag bit, mark whether important events, such as frame boundaries, are marked in the media stream;

The pt:payload type, the net charge types, for example: H263 is 34;

Sequence the serial number of the NUMBER:RTP package, the receiver can save the package sequence through this field, sorting the package, and can be used to statistic the packet loss rate; The first packet has a random value;

Timestamp: Time stamp, reflecting the sampling time of the first bit of the packet, and the time stamp value of each packet is linearly increased; When the MRP plays, each switch of a file, the timestamp jumps 5000;

SSRC: Synchronization source identification, Value random selection, the same RTP session of any two synchronization source will not have the same SSRC, that is, the synchronization source, the general one synchronization source is a time stamp + serial number space;

CSRC: Contribution source identification, identification of the source of the net charge, by the CC field specified number, up to 15;

B. Message is Net charge

Test point

The main fields of interest are serial numbers sequence number and time stamp timestamp,

A. Sequence number is illegal, that is, a series of RTP packets with an individual packet sequence is illegal, the product is discarded and normal recovery signal;

B. RTP packet disorderly sequence namely sequence number disorderly order, NP is correct sort, the signal recovers correctly;

C. When the RTP packet arrives at the product slowly and quickly (the delay is constantly changing jitter), the product can be handled correctly;

D. Be concerned about the acceptable latency boundary values for the product, such as the maximum latency that the product can support for g711 20ms pack-length speech packets;

The time stamp test point see the next section

2 Audio RTP package features

Take g711a as an example, the number of G711A encoded bits is 8 bits, such as the following table, the No. 0 bit is the polarity bit, 1 to 3 bits is the field code, 4-7 bits is the segment code, if the signal is sampled at 8K frequency, each sampling point is 8 bit encoded, and the encoding rate is obviously 64Kbps.

G711A encoded audio packets if packaged in 20ms, then each packet has 160 sample points (sampling frequency is 8KHZ, then the number of samples per millisecond is 8, so 20ms is 160), which is also reflected in the time stamp, the following figure, two packets between the time stamp interval is 160.

Also, the length of the payload is 160x1 bytes/packet = 160 bytes, see the figure below, the DSP reads the value of each sample point when decoding, the table can restore the signal.

3 Rate Calculation

For each media channel rate size description, can be used Kbps or the number of RTP packets per second, described in the former to facilitate the calculation of bandwidth, and the backplane/buckle logic Interface rate comparison, the latter is easy to calculate the NP processing packets.

A. For audio, knowing the length of the package can gu the number of packets transmitted per second, such as a package length of 20ms, which transmits 50 packets per second.

B. Calculating channel bandwidth rates

Rate =RTP Packet Size (header + net charge) x processing packets per second (1/pack cycle)

= (Ethernet head +ip head +udp +RTP head + payload) x (1/pack cycle)
= (208bit (not necessarily ) +160bit+64bit+96bit + payload) x (1/pack cycle)
= (528bit+ (packing period (seconds) x bits per second) x (1/pack cycle)
= (528/pack cycle) + bits per second

G711:20MS Package, bandwidth is (528/20 +) kbit/s=90.4 kbit/s

G729:20MS Package with bandwidth of (528/20 + 8) kbit/s= 34.4 kbit/s

Performance testing can be calculated according to the channel processing rate GU product processing performance.

Each header length is referenced in the following message format:

UDP header 8 bytes, 64 bits

IP header fixed length is 20 bytes, 160 bits

4 FAQs

1, how to know the size of the RTP net charge.

The UDP header has a field that records the length of the message, subtracting the RTP header from the field, which results in a net load length.

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.