mediaengine: cleanup

This commit is contained in:
backkem
2018-07-15 20:49:53 +02:00
committed by Sean DuBois
parent 7f682d2d2e
commit 1bdd1af406
2 changed files with 27 additions and 4 deletions

View File

@@ -50,10 +50,6 @@ func (m *mediaEngine) RegisterCodec(codec *RTCRtpCodec) uint8 {
return codec.PayloadType return codec.PayloadType
} }
func (m *mediaEngine) ClearCodecs() {
m.codecs = nil
}
func (m *mediaEngine) getCodec(payloadType uint8) (*RTCRtpCodec, error) { func (m *mediaEngine) getCodec(payloadType uint8) (*RTCRtpCodec, error) {
for _, codec := range m.codecs { for _, codec := range m.codecs {
if codec.PayloadType == payloadType { if codec.PayloadType == payloadType {

27
rtcconfiguration_test.go Normal file
View File

@@ -0,0 +1,27 @@
package webrtc
import (
"testing"
"time"
)
func TestRTCCertificate(t *testing.T) {
t.Run("Equals", func(t *testing.T) {
now := time.Now()
testCases := []struct {
first RTCCertificate
second RTCCertificate
expected bool
}{
{RTCCertificate{expires: now}, RTCCertificate{expires: now}, true},
{RTCCertificate{expires: now}, RTCCertificate{}, false},
}
for i, testCase := range testCases {
equal := testCase.first.Equals(testCase.second)
if equal != testCase.expected {
t.Errorf("Case %d: expected %t got %t", i, testCase.expected, equal)
}
}
})
}