diff --git a/server/internal/types/codec/codecs.go b/server/internal/types/codec/codecs.go index f3bc2baa..623088c8 100644 --- a/server/internal/types/codec/codecs.go +++ b/server/internal/types/codec/codecs.go @@ -55,7 +55,7 @@ type RTPCodec struct { Capability webrtc.RTPCodecCapability } -func (codec *RTPCodec) Register(engine *webrtc.MediaEngine) error { +func (codec RTPCodec) Register(engine *webrtc.MediaEngine) error { return engine.RegisterCodec(webrtc.RTPCodecParameters{ RTPCodecCapability: codec.Capability, PayloadType: codec.PayloadType, diff --git a/server/internal/webrtc/webrtc.go b/server/internal/webrtc/webrtc.go index d914dc97..d2c71492 100644 --- a/server/internal/webrtc/webrtc.go +++ b/server/internal/webrtc/webrtc.go @@ -157,18 +157,8 @@ func (manager *WebRTCManager) initAPI() error { // Create MediaEngine with selected codecs engine := webrtc.MediaEngine{} - - audioCodec := manager.capture.Audio().Codec() - _ = engine.RegisterCodec(webrtc.RTPCodecParameters{ - RTPCodecCapability: audioCodec.Capability, - PayloadType: audioCodec.PayloadType, - }, audioCodec.Type) - - videoCodec := manager.capture.Video().Codec() - _ = engine.RegisterCodec(webrtc.RTPCodecParameters{ - RTPCodecCapability: videoCodec.Capability, - PayloadType: videoCodec.PayloadType, - }, videoCodec.Type) + manager.capture.Audio().Codec().Register(&engine) + manager.capture.Video().Codec().Register(&engine) // Register Interceptors i := &interceptor.Registry{}