mirror of
https://github.com/pion/webrtc.git
synced 2025-10-05 15:16:52 +08:00
mediaengine: cleanup
This commit is contained in:
@@ -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
27
rtcconfiguration_test.go
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
Reference in New Issue
Block a user