commit 54727822bfb89441860d93010ef0e15ca9a319a7 from: Oliver Lowe date: Thu Jul 10 11:46:23 2025 UTC mpegts: shorter return No need to annotate the error; caller knows we're unmarshalling. commit - abc6381f91d6b8e36cfafad15375034229a640b8 commit + 54727822bfb89441860d93010ef0e15ca9a319a7 blob - 11b33ed58f898684b4749f191cc406324088c3d6 blob + 47311e83066e7178e9598b468e4afd0ab2efbe50 --- mpegts/codec.go +++ mpegts/codec.go @@ -29,6 +29,7 @@ func Unmarshal(buf []byte, p *Packet) error { // skip next 2 bits until later when we need to decode adaptation or payload. // now just get last 4 bits p.Continuity = buf[3] & 0x0f + afc := buf[3] >> 4 switch afc { case 0x01: @@ -43,10 +44,8 @@ func Unmarshal(buf []byte, p *Packet) error { default: return fmt.Errorf("neither adaptation field or payload present") } - if err := unmarshalPayload(buf, p); err != nil { - return fmt.Errorf("unmarshal payload: %w", err) - } - return nil + + return unmarshalPayload(buf, p) } func Decode(r io.Reader) (*Packet, error) {