diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 01de123d..be521a3b 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -40,3 +40,18 @@ func TestVersion(t *testing.T) { t.Errorf("unexpected version for RTP packet. Got: %v\n Want: %v\n", got, expect) } } + +// TestCsrcCount checks that we can correctly obtain the csrc count from an +// RTP packet. +func TestCsrcCount(t *testing.T) { + const ver, expect = 2, 2 + pkt := (&Pkt{ + V: ver, + CC: expect, + CSRC: make([][4]byte, expect), + }).Bytes(nil) + got := csrcCount(pkt) + if got != expect { + t.Errorf("unexpected csrc count for RTP packet. Got: %v\n Want: %v\n", got, expect) + } +}