rtp: added standards information regarding padding

This commit is contained in:
saxon 2018-11-21 13:07:01 +10:30
parent 6f1515cc46
commit 338bc53e24
1 changed files with 7 additions and 2 deletions

View File

@ -26,8 +26,10 @@ LICENSE
along with revid in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). along with revid in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses).
*/ */
// See https://tools.ietf.org/html/rfc6184 for rtp packet format /*
See https://tools.ietf.org/html/rfc6184 and https://tools.ietf.org/html/rfc3550
for rtp-h264 and rtp standards.
*/
package rtp package rtp
const ( const (
@ -88,6 +90,9 @@ func (p *Pkt) Bytes() []byte {
buf[11] = byte(p.SSRC) buf[11] = byte(p.SSRC)
buf = append(buf, p.Payload...) buf = append(buf, p.Payload...)
// see https://tools.ietf.org/html/rfc3550 section 5.1 (padding). At end of
// rtp packet, padding may exist, with the last octet being the length of the
// padding including itself.
if p.Padding != 0 { if p.Padding != 0 {
buf = buf[:cap(buf)] buf = buf[:cap(buf)]
buf[len(buf)-1] = byte(p.Padding) buf[len(buf)-1] = byte(p.Padding)