psi: modified addPadding to only do one resize

This commit is contained in:
saxon 2019-01-12 17:51:39 +10:30
parent 46f5ffd6f2
commit c4e2ca64a9
2 changed files with 6 additions and 4 deletions

View File

@ -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 // addPadding adds an appropriate amount of padding to a pat or pmt table for
// addition to an mpegts packet // addition to an mpegts packet
func addPadding(d []byte) []byte { func addPadding(d []byte) []byte {
for len(d) < PktSize { t := make([]byte, PacketSize)
d = append(d, 0xff) copy(t, d)
padding := t[len(d):]
for i := range padding {
padding[i] = 0xff
} }
return d return d
} }

View File

@ -26,9 +26,8 @@ LICENSE
package psi package psi
// Misc consts
const ( const (
PktSize = 184 PacketSize = 184 // packet size of a psi.
) )
// Lengths of section definitions // Lengths of section definitions