Skip to content

Commit

Permalink
Avoid usage of OBUElements in av1_packet_test
Browse files Browse the repository at this point in the history
It's deprecated.
  • Loading branch information
jech committed Apr 15, 2024
1 parent 1a1a9c0 commit 242f5de
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
2 changes: 2 additions & 0 deletions codecs/av1_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ func (p *AV1Packet) Unmarshal(payload []byte) ([]byte, error) {
return nil, err
}
p.OBUElements = elts
} else {
p.OBUElements = nil
}

return payload[1:], nil
Expand Down
32 changes: 22 additions & 10 deletions codecs/av1_packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,20 +275,32 @@ func TestAV1_Unmarshal(t *testing.T) {
}

av1Pkt := &AV1Packet{}
if _, err := av1Pkt.Unmarshal(av1Payload); err != nil {
av1Pkt.SetDontParseBody(true)
payload, err := av1Pkt.Unmarshal(av1Payload)
if err != nil {
t.Fatal(err)
}

t.Log(*av1Pkt)
if !reflect.DeepEqual(av1Pkt, &AV1Packet{
Z: false,
Y: true,
W: 2,
N: true,
OBUElements: [][]byte{
av1Payload[2:14],
av1Payload[14:],
},
Z: false,
Y: true,
W: 2,
N: true,
dontParseBody: true,
}) {
t.Fatal("AV1 Unmarshal didn't store the expected results in the packet")
t.Error("AV1 Unmarshal didn't store the expected results in the packet")
}

obus, err := av1Pkt.ParseBody(payload)
if err != nil {
t.Fatal("ParseOBUElements: ", err)
}

if !reflect.DeepEqual(obus, [][]byte{
av1Payload[2:14],
av1Payload[14:],
}) {
t.Fatal("Unexpected value ParseOBUElements")
}
}

0 comments on commit 242f5de

Please sign in to comment.