diff --git a/stream/mts/psi/helpers.go b/stream/mts/psi/helpers.go index 42f0c5fd..9beecab4 100644 --- a/stream/mts/psi/helpers.go +++ b/stream/mts/psi/helpers.go @@ -132,8 +132,11 @@ func trimTo(d []byte, t byte) []byte { // addPadding adds an appropriate amount of padding to a pat or pmt table for // addition to an mpegts packet func addPadding(d []byte) []byte { - for len(d) < PktSize { - d = append(d, 0xff) + t := make([]byte, PacketSize) + copy(t, d) + padding := t[len(d):] + for i := range padding { + padding[i] = 0xff } return d } diff --git a/stream/mts/psi/psi.go b/stream/mts/psi/psi.go index 4d76110d..09028ba6 100644 --- a/stream/mts/psi/psi.go +++ b/stream/mts/psi/psi.go @@ -26,9 +26,8 @@ LICENSE package psi -// Misc consts const ( - PktSize = 184 + PacketSize = 184 // packet size of a psi. ) // Lengths of section definitions