From 05b9416aa46e6bc511f68697f3c9d254e714bb9b Mon Sep 17 00:00:00 2001 From: saxon Date: Sat, 18 Aug 2018 01:00:51 +0930 Subject: [PATCH] Simplified code --- generator/mpegts_generator.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/generator/mpegts_generator.go b/generator/mpegts_generator.go index 5487620b..6917516b 100644 --- a/generator/mpegts_generator.go +++ b/generator/mpegts_generator.go @@ -31,7 +31,7 @@ import ( "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 var ( @@ -43,10 +43,10 @@ var ( // with 0xFFs - because it looks ugly to hardcode above. This is called through // NewMpegtsgenerator func genPatAndPmt() { - for len(patTable) < mpegtsPacketSize { + for len(patTable) < psiPacketSize { patTable = append(patTable, 255) } - for len(pmtTable) < mpegtsPacketSize { + for len(pmtTable) < psiPacketSize { pmtTable = append(pmtTable, 255) } } @@ -160,10 +160,10 @@ func (g *tsGenerator) generate() { Data: nalUnit, HeaderLength: 5, } - g.pesPktChan <- pesPkt.ToByteSlice() - case pesPkt := <-g.pesPktChan: - for ii := range pesPkt { - g.payloadByteChan <- pesPkt[ii] + pesPktSlice := pesPkt.ToByteSlice() + + for ii := range pesPktSlice { + g.payloadByteChan <- pesPktSlice[ii] } pusi := true for len(g.payloadByteChan) > 0 {