From 9dcf866162d691f00dbba79a3193d9d50cb79f20 Mon Sep 17 00:00:00 2001 From: Saxon Date: Wed, 8 May 2019 00:06:05 +0930 Subject: [PATCH] container/mts/mpegts.go: removed unused const --- container/mts/mpegts.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/container/mts/mpegts.go b/container/mts/mpegts.go index 6cf16e25..02634fe2 100644 --- a/container/mts/mpegts.go +++ b/container/mts/mpegts.go @@ -35,11 +35,7 @@ import ( "github.com/Comcast/gots/packet" ) -// General mpegts packet properties. -const ( - PacketSize = 188 - MaxPayloadSize = 176 -) +const PacketSize = 188 // Program ID for various types of ts packets. const ( @@ -230,14 +226,14 @@ func (p *Packet) Bytes(buf []byte) []byte { buf[3] = (p.TSC<<6 | p.AFC<<4 | p.CC) var maxPayloadSize int - if p.AFC & 0x2 != 0 { + if p.AFC&0x2 != 0 { maxPayloadSize = PacketSize - 6 - asInt(p.PCRF)*6 } else { maxPayloadSize = PacketSize - 4 } - stuffingLen := maxPayloadSize -len(p.Payload) - if p.AFC & 0x2 != 0 { + stuffingLen := maxPayloadSize - len(p.Payload) + if p.AFC&0x2 != 0 { buf[4] = byte(1 + stuffingLen + asInt(p.PCRF)*6) buf[5] = (asByte(p.DI)<<7 | asByte(p.RAI)<<6 | asByte(p.ESPI)<<5 | asByte(p.PCRF)<<4 | asByte(p.OPCRF)<<3 | asByte(p.SPF)<<2 | asByte(p.TPDF)<<1 | asByte(p.AFEF)) } else { @@ -253,11 +249,10 @@ func (p *Packet) Bytes(buf []byte) []byte { } curLen := len(buf) buf = buf[:PacketSize] - copy(buf[curLen:],p.Payload) + copy(buf[curLen:], p.Payload) return buf } - func asInt(b bool) int { if b { return 1