diff --git a/stream/mts/encoder.go b/stream/mts/encoder.go index 0e52cb70..7bda82c7 100644 --- a/stream/mts/encoder.go +++ b/stream/mts/encoder.go @@ -216,7 +216,7 @@ func (e *Encoder) writePSI() error { if err != nil { return err } - err = updateMeta(&pmtTable) + pmtTable, err = updateMeta(pmtTable) if err != nil { return err } @@ -262,9 +262,8 @@ func (e *Encoder) ccFor(pid int) byte { // updateMeta adds/updates a metaData descriptor in the given psi bytes using data // contained in the global Meta struct. -func updateMeta(b *[]byte) error { - p := psi.PSIBytes(*b) +func updateMeta(b []byte) ([]byte, error) { + p := psi.PSIBytes(b) err := p.AddDescriptor(psi.MetadataTag, Meta.Encode()) - *b = []byte(p) - return err + return []byte(p), err }