Skip to content

Commit

Permalink
Drop calls to RegisterDefaultCodecs in tests
Browse files Browse the repository at this point in the history
Not needed anymore
  • Loading branch information
Sean-Der committed Jul 18, 2024
1 parent 8780e68 commit 9c6604d
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 23 deletions.
3 changes: 0 additions & 3 deletions api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 2 additions & 8 deletions interceptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion mediaengine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions ortc_media_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 1 addition & 3 deletions peerconnection_go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}),
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion peerconnection_renegotiation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
5 changes: 1 addition & 4 deletions rtpsender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 9c6604d

Please sign in to comment.