From d5b6e91892cff15897335cfb8fdfd0be406cad44 Mon Sep 17 00:00:00 2001 From: saxon Date: Wed, 2 Jan 2019 10:32:48 +1030 Subject: [PATCH] rtp: using 'size' instead of 'len' --- stream/rtp/encoder.go | 4 ++-- stream/rtp/rtp.go | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/stream/rtp/encoder.go b/stream/rtp/encoder.go index 88bebc4f..20df9434 100644 --- a/stream/rtp/encoder.go +++ b/stream/rtp/encoder.go @@ -53,7 +53,7 @@ type Encoder struct { frameInterval time.Duration fps int buffer []byte - pktSpace [defPktLen]byte + pktSpace [defPktSize]byte } // NewEncoder returns a new Encoder type given an io.Writer - the destination @@ -94,7 +94,7 @@ func (e *Encoder) Encode(payload []byte) error { Payload: payload, Padding: no, } - _, err := e.dst.Write(pkt.Bytes(e.pktSpace[:defPktLen])) + _, err := e.dst.Write(pkt.Bytes(e.pktSpace[:defPktSize])) if err != nil { return err } diff --git a/stream/rtp/rtp.go b/stream/rtp/rtp.go index 5d6e0ace..34e30fd3 100644 --- a/stream/rtp/rtp.go +++ b/stream/rtp/rtp.go @@ -33,10 +33,10 @@ for rtp-h264 and rtp standards. package rtp const ( - rtpVer = 2 - headLen = 3 * 4 - defPayloadLen = 7 * 188 - defPktLen = headLen + defPayloadLen + rtpVer = 2 + headSize = 3 * 4 + defPayloadSize = 7 * 188 + defPktSize = headSize + defPayloadSize ) // Pkt provides fields consistent with RFC3550 definition of an rtp packet @@ -57,10 +57,10 @@ type Pkt struct { // Bytes provides a byte slice of the packet func (p *Pkt) Bytes(buf []byte) []byte { - if buf == nil || len(buf) != defPktLen { - buf = make([]byte, headLen, defPktLen) + if buf == nil || len(buf) != defPktSize { + buf = make([]byte, headSize, defPktSize) } - buf = buf[:headLen] + buf = buf[:headSize] if p.V == 0 { p.V = rtpVer }