From 9c6604df0a46b1a32eb7f7180919a0afae9caf11 Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Thu, 18 Jul 2024 16:14:23 -0400 Subject: [PATCH] Drop calls to RegisterDefaultCodecs in tests Not needed anymore --- api_test.go | 3 --- interceptor_test.go | 10 ++-------- mediaengine_test.go | 2 +- ortc_media_test.go | 3 --- peerconnection_go_test.go | 4 +--- peerconnection_renegotiation_test.go | 1 - rtpsender_test.go | 5 +---- 7 files changed, 5 insertions(+), 23 deletions(-) diff --git a/api_test.go b/api_test.go index 3724fba9c32..06f27697fcc 100644 --- a/api_test.go +++ b/api_test.go @@ -31,12 +31,9 @@ func TestNewAPI(t *testing.T) { func TestNewAPI_Options(t *testing.T) { s := SettingEngine{} s.DetachDataChannels() - m := MediaEngine{} - assert.NoError(t, m.RegisterDefaultCodecs()) api := NewAPI( WithSettingEngine(s), - WithMediaEngine(&m), ) if !api.settingEngine.detach.DataChannels { diff --git a/interceptor_test.go b/interceptor_test.go index 31cfe058341..aad610bb35d 100644 --- a/interceptor_test.go +++ b/interceptor_test.go @@ -33,9 +33,6 @@ func TestPeerConnection_Interceptor(t *testing.T) { defer report() createPC := func() *PeerConnection { - m := &MediaEngine{} - assert.NoError(t, m.RegisterDefaultCodecs()) - ir := &interceptor.Registry{} ir.Add(&mock_interceptor.Factory{ NewInterceptorFn: func(_ string) (interceptor.Interceptor, error) { @@ -64,7 +61,7 @@ func TestPeerConnection_Interceptor(t *testing.T) { }, }) - pc, err := NewAPI(WithMediaEngine(m), WithInterceptorRegistry(ir)).NewPeerConnection(Configuration{}) + pc, err := NewAPI(WithInterceptorRegistry(ir)).NewPeerConnection(Configuration{}) assert.NoError(t, err) return pc @@ -115,9 +112,6 @@ func Test_Interceptor_BindUnbind(t *testing.T) { report := test.CheckRoutines(t) defer report() - m := &MediaEngine{} - assert.NoError(t, m.RegisterDefaultCodecs()) - var ( cntBindRTCPReader uint32 cntBindRTCPWriter uint32 @@ -160,7 +154,7 @@ func Test_Interceptor_BindUnbind(t *testing.T) { NewInterceptorFn: func(_ string) (interceptor.Interceptor, error) { return mockInterceptor, nil }, }) - sender, receiver, err := NewAPI(WithMediaEngine(m), WithInterceptorRegistry(ir)).newPair(Configuration{}) + sender, receiver, err := NewAPI(WithInterceptorRegistry(ir)).newPair(Configuration{}) assert.NoError(t, err) track, err := NewTrackLocalStaticSample(RTPCodecCapability{MimeType: MimeTypeVP8}, "video", "pion") diff --git a/mediaengine_test.go b/mediaengine_test.go index 28f76069fbe..786cbcac0af 100644 --- a/mediaengine_test.go +++ b/mediaengine_test.go @@ -341,7 +341,7 @@ a=rtpmap:96 VP8/90000 o=- 4596489990601351948 2 IN IP4 127.0.0.1 s=- t=0 0 -m=video 60323 UDP/TLS/RTP/SAVPF 94 95 106 107 108 109 96 97 +m=video 60323 UDP/TLS/RTP/SAVPF 94 95 106 107 108 109 96 97 a=rtpmap:94 VP8/90000 a=rtpmap:95 rtx/90000 a=fmtp:95 apt=94 diff --git a/ortc_media_test.go b/ortc_media_test.go index 5d9624166dd..7d81662e60e 100644 --- a/ortc_media_test.go +++ b/ortc_media_test.go @@ -26,9 +26,6 @@ func Test_ORTC_Media(t *testing.T) { stackA, stackB, err := newORTCPair() assert.NoError(t, err) - assert.NoError(t, stackA.api.mediaEngine.RegisterDefaultCodecs()) - assert.NoError(t, stackB.api.mediaEngine.RegisterDefaultCodecs()) - assert.NoError(t, signalORTCPair(stackA, stackB)) track, err := NewTrackLocalStaticSample(RTPCodecCapability{MimeType: MimeTypeVP8}, "video", "pion") diff --git a/peerconnection_go_test.go b/peerconnection_go_test.go index 2cafdd68a07..1123edf8fed 100644 --- a/peerconnection_go_test.go +++ b/peerconnection_go_test.go @@ -1030,7 +1030,6 @@ func (r *trackRecords) remains() int { // This test assure that all track events emits. func TestPeerConnection_MassiveTracks(t *testing.T) { var ( - api = NewAPI() tRecs = &trackRecords{ trackIDs: make(map[string]struct{}), receivedTrackIDs: make(map[string]struct{}), @@ -1059,8 +1058,7 @@ func TestPeerConnection_MassiveTracks(t *testing.T) { connected = make(chan struct{}) stopped = make(chan struct{}) ) - assert.NoError(t, api.mediaEngine.RegisterDefaultCodecs()) - offerPC, answerPC, err := api.newPair(Configuration{}) + offerPC, answerPC, err := newPair() assert.NoError(t, err) // Create massive tracks. for range make([]struct{}, trackCount) { diff --git a/peerconnection_renegotiation_test.go b/peerconnection_renegotiation_test.go index ac923d9dab9..33bc714f774 100644 --- a/peerconnection_renegotiation_test.go +++ b/peerconnection_renegotiation_test.go @@ -603,7 +603,6 @@ func TestPeerConnection_Renegotiation_Trickle(t *testing.T) { settingEngine := SettingEngine{} api := NewAPI(WithSettingEngine(settingEngine)) - assert.NoError(t, api.mediaEngine.RegisterDefaultCodecs()) // Invalid STUN server on purpose, will stop ICE Gathering from completing in time pcOffer, pcAnswer, err := api.newPair(Configuration{ diff --git a/rtpsender_test.go b/rtpsender_test.go index cd77976f96e..9b4863ca4aa 100644 --- a/rtpsender_test.go +++ b/rtpsender_test.go @@ -29,10 +29,7 @@ func Test_RTPSender_ReplaceTrack(t *testing.T) { s := SettingEngine{} s.DisableSRTPReplayProtection(true) - m := &MediaEngine{} - assert.NoError(t, m.RegisterDefaultCodecs()) - - sender, receiver, err := NewAPI(WithMediaEngine(m), WithSettingEngine(s)).newPair(Configuration{}) + sender, receiver, err := NewAPI(WithSettingEngine(s)).newPair(Configuration{}) assert.NoError(t, err) trackA, err := NewTrackLocalStaticSample(RTPCodecCapability{MimeType: MimeTypeVP8}, "video", "pion")