mirror of
https://github.com/encounter/webrtc.git
synced 2026-03-30 11:42:19 -07:00
15b7a88224
Remove dependency on API Related to #434
54 lines
1.0 KiB
Go
54 lines
1.0 KiB
Go
package webrtc
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/pions/sdp/v2"
|
|
)
|
|
|
|
func TestCodecRegistration(t *testing.T) {
|
|
const invalidPT = 255
|
|
|
|
codecs := DefaultCodecs
|
|
|
|
for _, test := range []struct {
|
|
PayloadType uint8
|
|
WantError error
|
|
}{
|
|
{
|
|
PayloadType: DefaultPayloadTypeG722,
|
|
WantError: nil,
|
|
},
|
|
{
|
|
PayloadType: DefaultPayloadTypeOpus,
|
|
WantError: nil,
|
|
},
|
|
{
|
|
PayloadType: DefaultPayloadTypeVP8,
|
|
WantError: nil,
|
|
},
|
|
{
|
|
PayloadType: DefaultPayloadTypeVP9,
|
|
WantError: nil,
|
|
},
|
|
{
|
|
PayloadType: DefaultPayloadTypeH264,
|
|
WantError: nil,
|
|
},
|
|
{
|
|
PayloadType: invalidPT,
|
|
WantError: ErrCodecNotFound,
|
|
},
|
|
} {
|
|
_, err := codecs.getCodec(test.PayloadType)
|
|
if got, want := err, test.WantError; got != want {
|
|
t.Fatalf("getCodec(%v): err=%v, want %v", test.PayloadType, got, want)
|
|
}
|
|
}
|
|
|
|
_, err := codecs.getCodecSDP(sdp.Codec{PayloadType: invalidPT})
|
|
if got, want := err, ErrCodecNotFound; got != want {
|
|
t.Fatalf("getCodecSDP(invalidPT): err=%v, want %v", got, want)
|
|
}
|
|
}
|