Skip to content

Commit 567aefb

Browse files
committed
Fix parsing of G bit in VP9 scalability structure
Previously it would erroneously look at some of the reserved fields.
1 parent f406d45 commit 567aefb

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

codecs/vp9_packet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func (p *VP9Packet) parseSSData(packet []byte, pos int) (int, error) {
338338

339339
p.NS = packet[pos] >> 5
340340
p.Y = packet[pos]&0x10 != 0
341-
p.G = (packet[pos]>>1)&0x7 != 0
341+
p.G = packet[pos]&0x8 != 0
342342
pos++
343343

344344
NS := p.NS + 1

codecs/vp9_packet_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,21 @@ func TestVP9Packet_Unmarshal(t *testing.T) {
167167
Payload: []byte{},
168168
},
169169
},
170+
"ScalabilityStructureReserved": {
171+
b: []byte{
172+
0x0A,
173+
(1 << 5) | (0 << 4) | (0 << 3) | (1 << 2) | (1 << 1) | 1, // NS:1 Y:0 G:0, reserved fields set to 1
174+
},
175+
pkt: VP9Packet{
176+
B: true,
177+
V: true,
178+
NS: 1,
179+
Y: false,
180+
G: false,
181+
NG: 0,
182+
Payload: []byte{},
183+
},
184+
},
170185
"ScalabilityStructure_ShortPacket0": {
171186
b: []byte{0x0A, 0x10},
172187
err: errShortPacket,

0 commit comments

Comments
 (0)