From 8d7ea92445d103716fded8e9f62892f1e13d00ae Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sat, 4 Jan 2025 18:49:46 +0100 Subject: [PATCH] Add TestPayloadTypesDiscontiguous. --- group/group_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/group/group_test.go b/group/group_test.go index 1d8bb89..261517d 100644 --- a/group/group_test.go +++ b/group/group_test.go @@ -7,6 +7,8 @@ import ( "sort" "testing" "time" + + "github.com/pion/webrtc/v4" ) func TestGroup(t *testing.T) { @@ -348,3 +350,32 @@ func TestValidGroupName(t *testing.T) { } } } + +func TestPayloadTypeDiscontiguous(t *testing.T) { + names := []string{ + "vp8", "vp9", "av1", "h264", + "opus", "g722", "pcmu", "pcma", + } + + m := make(map[webrtc.PayloadType]bool) + + for _, n := range names { + codec, err := codecsFromName(n) + if err != nil { + t.Errorf("%v: %v", n, err) + continue + } + pt, err := CodecPayloadType(codec[0].RTPCodecCapability) + if err != nil { + t.Errorf("%v: %v", codec, err) + continue + } + m[pt] = true + } + + for pt := range m { + if m[pt+1] { + t.Errorf("%v and %v are both defined", pt, pt+1) + } + } +}