streaming

Media streaming and broadcast systems in Go
Log | Files | Refs | README | LICENSE

commit 54727822bfb89441860d93010ef0e15ca9a319a7
parent abc6381f91d6b8e36cfafad15375034229a640b8
Author: Oliver Lowe <o@olowe.co>
Date:   Thu, 10 Jul 2025 21:46:23 +1000

mpegts: shorter return

No need to annotate the error; caller knows we're unmarshalling.

Diffstat:
Mmpegts/codec.go | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mpegts/codec.go b/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) {