Simplified code

This commit is contained in:
saxon 2018-08-18 01:00:51 +09:30
parent 6b2644a517
commit 05b9416aa4
1 changed files with 7 additions and 7 deletions

View File

@ -31,7 +31,7 @@ import (
"bitbucket.org/ausocean/av/pes" "bitbucket.org/ausocean/av/pes"
) )
const mpegtsPacketSize = 184 const psiPacketSize = 184
// TODO: really need to finish the at and pmt stuff - this is too hacky // TODO: really need to finish the at and pmt stuff - this is too hacky
var ( var (
@ -43,10 +43,10 @@ var (
// with 0xFFs - because it looks ugly to hardcode above. This is called through // with 0xFFs - because it looks ugly to hardcode above. This is called through
// NewMpegtsgenerator // NewMpegtsgenerator
func genPatAndPmt() { func genPatAndPmt() {
for len(patTable) < mpegtsPacketSize { for len(patTable) < psiPacketSize {
patTable = append(patTable, 255) patTable = append(patTable, 255)
} }
for len(pmtTable) < mpegtsPacketSize { for len(pmtTable) < psiPacketSize {
pmtTable = append(pmtTable, 255) pmtTable = append(pmtTable, 255)
} }
} }
@ -160,10 +160,10 @@ func (g *tsGenerator) generate() {
Data: nalUnit, Data: nalUnit,
HeaderLength: 5, HeaderLength: 5,
} }
g.pesPktChan <- pesPkt.ToByteSlice() pesPktSlice := pesPkt.ToByteSlice()
case pesPkt := <-g.pesPktChan:
for ii := range pesPkt { for ii := range pesPktSlice {
g.payloadByteChan <- pesPkt[ii] g.payloadByteChan <- pesPktSlice[ii]
} }
pusi := true pusi := true
for len(g.payloadByteChan) > 0 { for len(g.payloadByteChan) > 0 {