From 338bc53e24528c291d1fe9104f6b60e24b176ce3 Mon Sep 17 00:00:00 2001 From: saxon Date: Wed, 21 Nov 2018 13:07:01 +1030 Subject: [PATCH] rtp: added standards information regarding padding --- stream/rtp/rtp.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stream/rtp/rtp.go b/stream/rtp/rtp.go index fa62d9fb..3d474647 100644 --- a/stream/rtp/rtp.go +++ b/stream/rtp/rtp.go @@ -26,8 +26,10 @@ LICENSE 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 const ( @@ -88,6 +90,9 @@ func (p *Pkt) Bytes() []byte { buf[11] = byte(p.SSRC) 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 { buf = buf[:cap(buf)] buf[len(buf)-1] = byte(p.Padding)