streaming

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

commit 947ac78cf7609137d996869dd37f1ebeada69ee1
parent 98bae7beffa702ed22bdce49c53e3fe8f738e446
Author: Oliver Lowe <o@olowe.co>
Date:   Sat, 22 Jun 2024 14:59:54 +1000

rtp: correctly detect extension field in header

We were accidentally reading from the wrong byte.

Diffstat:
Mrtp/rtp.go | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtp/rtp.go b/rtp/rtp.go @@ -126,6 +126,7 @@ func Unmarshal(data []byte, p *Packet) error { p.Header.Version = uint8(data[0] & 0b11000000) p.Header.padding = data[0]&0b00100000 > 0 + hasExtension := data[0]&0b00010000 > 0 // extension bit, ignore til later, 0b00010000 cc := data[0] & 0b00001111 if cc > 0 { @@ -145,8 +146,7 @@ func Unmarshal(data []byte, p *Packet) error { } data = data[12:] - // is the extension bit set? - if data[0]&0b00010000 > 0 { + if hasExtension { if len(data) < 4 { return fmt.Errorf("header extension: %d bytes after header, need %d", len(data), 4) }