From 2ff7e6318d3b853c193ca30bb27caf8114651f9e Mon Sep 17 00:00:00 2001 From: saxon Date: Wed, 21 Nov 2018 00:51:57 +1030 Subject: [PATCH] mts: made psi counter max packet interval const --- stream/mts/encoder.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/stream/mts/encoder.go b/stream/mts/encoder.go index 8d557123..9dc48dec 100644 --- a/stream/mts/encoder.go +++ b/stream/mts/encoder.go @@ -38,7 +38,10 @@ import ( "bitbucket.org/ausocean/av/stream/mts/pes" ) -const psiPacketSize = 184 +const ( + psiPacketSize = 184 + psiSendCount = 100 +) // TODO: really need to finish the at and pmt stuff - this is too hacky var ( @@ -197,7 +200,7 @@ const ( // generate handles the incoming data and generates equivalent mpegts packets - // sending them to the output channel func (e *Encoder) Encode(nalu []byte) error { - if e.psiCount == 0 { + if e.psiCount <= 0 { // Write PAT patPkt := Packet{ PUSI: true, @@ -223,7 +226,7 @@ func (e *Encoder) Encode(nalu []byte) error { if err != nil { return err } - e.psiCount = 100 + e.psiCount = psiSendCount } e.psiCount -= 1 // Prepare PES data.