From 8d0468ea629ba19e4a498bf1d5783befa9d45591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 29 Jan 2023 18:22:48 +0100 Subject: [PATCH] codec is video & audio. --- server/internal/capture/streamsink.go | 2 +- server/internal/types/codec/codecs.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server/internal/capture/streamsink.go b/server/internal/capture/streamsink.go index 03cb16dc..61eb315f 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 621655e0..4c5b8435 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",