Reputation: 490
According to RFC 6184 in
5.6. Single NAL Unit Packet :
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|F|NRI| Type | |
+-+-+-+-+-+-+-+-+ |
| |
| Bytes 2..n of a single NAL unit |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :...OPTIONAL RTP padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
How can I know what is the size of RTP padding? and What's the purpose of RTP padding?
Upvotes: 1
Views: 899
Reputation: 526
It's assumed that you know the packet size in advance, e.g. from the underlying protocol layer: UDP, TCP, SCTP and so on. So, if padding (P) bit is set to 1, you should read the last byte of the packet which contains a count of how many padding octets should be ignored, including the last byte itself.
The purpose of padding is clearly explained in Section 5.1 of RFC 3550:
Padding may be needed by some encryption algorithms with fixed block sizes or for carrying several RTP packets in a lower-layer protocol data unit.
Upvotes: 1