rtcp
rtcp copied to clipboard
Impossible to parse a header with padding
Your environment.
- Version: 7ca6b6fa4f82ad515c46e42e6692367f9258da5c
What did you do?
rrWithPadding := []byte{
// v=2, p=1, count=1, RR, len=7
0xa1, 0xc9, 0x0, 0x7,
// ssrc=0x902f9e2e
0x90, 0x2f, 0x9e, 0x2e,
// ssrc=0xbc5e9a40
0xbc, 0x5e, 0x9a, 0x40,
// fracLost=0, totalLost=0
0x0, 0x0, 0x0, 0x0,
// lastSeq=0x46e1
0x0, 0x0, 0x46, 0xe1,
// jitter=273
0x0, 0x0, 0x1, 0x11,
// lsr=0x9f36432
0x9, 0xf3, 0x64, 0x32,
// delay=150137
0x0, 0x2, 0x4a, 0x79,
}
pkts, _ := Unmarshal(rrWithPadding)
fmt.Println(pkts[0].Header().Padding)
What did you expect?
For it to return true, since the padding flag is set.
What happened?
It returns false, because we use a synthetic header after parsing, and this header always has the padding bit set to false.
This is fine for most cases, but it means that we can't implement the validity check that requires the first packet in a compound doesn't have padding.
This can be solved by adding a PaddingSize
field to every rtcp.Packet
, like rtp.Packet.