The RTP header defined in RFC 3550 includes a bit that tells if padding is used or not. If padding is used, this bit will be set to 1. If an RTP packet has the padding bit set, it is required to use padding. Padding is the addition of extra bytes at the end of an RTP packet that do not contribute to the packet’s payload data. Padding bytes are added to the end of an RTP packet, immediately after the payload data. The last byte of the padding must contain the number of extra bytes that were added. When there is no padding, the length of the payload data is inferred from the RTP packet size; everything after the header is the payload. With padding, the size of the payload plus padding can be inferred, so the size of the padding must be known to find the size of the payload.
The most common use for padding in RTP packets is to ensure that every RTP packet has the same size. Many codecs, especially video codecs, generate payload data of varying sizes. When such a codec is used, ensuring a constant RTP packet size can smooth out the bandwidth requirements. It can also be useful for encrypted streams. Making all packets the same size makes it easy to use block ciphers that operate on a specific sized block. It also hides the packet size information.