container/mts/mpegts.go: removed unused const

This commit is contained in:
Saxon 2019-05-08 00:06:05 +09:30
parent 1e7d3508e3
commit 9dcf866162
1 changed files with 5 additions and 10 deletions

View File

@ -35,11 +35,7 @@ import (
"github.com/Comcast/gots/packet" "github.com/Comcast/gots/packet"
) )
// General mpegts packet properties. const PacketSize = 188
const (
PacketSize = 188
MaxPayloadSize = 176
)
// Program ID for various types of ts packets. // Program ID for various types of ts packets.
const ( const (
@ -230,14 +226,14 @@ func (p *Packet) Bytes(buf []byte) []byte {
buf[3] = (p.TSC<<6 | p.AFC<<4 | p.CC) buf[3] = (p.TSC<<6 | p.AFC<<4 | p.CC)
var maxPayloadSize int var maxPayloadSize int
if p.AFC & 0x2 != 0 { if p.AFC&0x2 != 0 {
maxPayloadSize = PacketSize - 6 - asInt(p.PCRF)*6 maxPayloadSize = PacketSize - 6 - asInt(p.PCRF)*6
} else { } else {
maxPayloadSize = PacketSize - 4 maxPayloadSize = PacketSize - 4
} }
stuffingLen := maxPayloadSize -len(p.Payload) stuffingLen := maxPayloadSize - len(p.Payload)
if p.AFC & 0x2 != 0 { if p.AFC&0x2 != 0 {
buf[4] = byte(1 + stuffingLen + asInt(p.PCRF)*6) 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)) 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 { } else {
@ -253,11 +249,10 @@ func (p *Packet) Bytes(buf []byte) []byte {
} }
curLen := len(buf) curLen := len(buf)
buf = buf[:PacketSize] buf = buf[:PacketSize]
copy(buf[curLen:],p.Payload) copy(buf[curLen:], p.Payload)
return buf return buf
} }
func asInt(b bool) int { func asInt(b bool) int {
if b { if b {
return 1 return 1