diff --git a/server/internal/capture/streamsink.go b/server/internal/capture/streamsink.go index 03cb16d..61eb315 100644 --- a/server/internal/capture/streamsink.go +++ b/server/internal/capture/streamsink.go @@ -145,7 +145,7 @@ func (manager *StreamSinkManagerCtx) createPipeline() error { } appsinkSubfix := "audio" - if codec.IsVideo(manager.codec.Type) { + if manager.codec.IsVideo() { appsinkSubfix = "video" } diff --git a/server/internal/types/codec/codecs.go b/server/internal/types/codec/codecs.go index 621655e..4c5b843 100644 --- a/server/internal/types/codec/codecs.go +++ b/server/internal/types/codec/codecs.go @@ -50,14 +50,6 @@ func ParseStr(codecName string) (codec RTPCodec, ok bool) { return } -func IsVideo(codecType webrtc.RTPCodecType) bool { - return codecType == webrtc.RTPCodecTypeVideo -} - -func IsAudio(codecType webrtc.RTPCodecType) bool { - return codecType == webrtc.RTPCodecTypeAudio -} - type RTPCodec struct { Name string PayloadType webrtc.PayloadType @@ -72,6 +64,14 @@ func (codec RTPCodec) Register(engine *webrtc.MediaEngine) error { }, codec.Type) } +func (codec RTPCodec) IsVideo() bool { + return codec.Type == webrtc.RTPCodecTypeVideo +} + +func (codec RTPCodec) IsAudio() bool { + return codec.Type == webrtc.RTPCodecTypeAudio +} + func VP8() RTPCodec { return RTPCodec{ Name: "vp8",