mirror of
https://github.com/pion/webrtc.git
synced 2024-05-03 11:54:53 +08:00
1cdfc10c84
Pions organization was renamed to pion
38 lines
715 B
Go
38 lines
715 B
Go
// +build !js
|
|
|
|
package webrtc
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/pion/sdp/v2"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCodecRegistration(t *testing.T) {
|
|
api := NewAPI()
|
|
const invalidPT = 255
|
|
|
|
api.mediaEngine.RegisterDefaultCodecs()
|
|
|
|
testCases := []struct {
|
|
c uint8
|
|
e error
|
|
}{
|
|
{DefaultPayloadTypeG722, nil},
|
|
{DefaultPayloadTypeOpus, nil},
|
|
{DefaultPayloadTypeVP8, nil},
|
|
{DefaultPayloadTypeVP9, nil},
|
|
{DefaultPayloadTypeH264, nil},
|
|
{invalidPT, ErrCodecNotFound},
|
|
}
|
|
|
|
for _, f := range testCases {
|
|
_, err := api.mediaEngine.getCodec(f.c)
|
|
assert.Equal(t, f.e, err)
|
|
|
|
}
|
|
_, err := api.mediaEngine.getCodecSDP(sdp.Codec{PayloadType: invalidPT})
|
|
assert.Equal(t, err, ErrCodecNotFound)
|
|
}
|