codec is video & audio.

This commit is contained in:
Miroslav Šedivý 2023-01-29 18:22:48 +01:00
parent 89737dd4ce
commit 8d0468ea62
2 changed files with 9 additions and 9 deletions

View File

@ -145,7 +145,7 @@ func (manager *StreamSinkManagerCtx) createPipeline() error {
} }
appsinkSubfix := "audio" appsinkSubfix := "audio"
if codec.IsVideo(manager.codec.Type) { if manager.codec.IsVideo() {
appsinkSubfix = "video" appsinkSubfix = "video"
} }

View File

@ -50,14 +50,6 @@ func ParseStr(codecName string) (codec RTPCodec, ok bool) {
return return
} }
func IsVideo(codecType webrtc.RTPCodecType) bool {
return codecType == webrtc.RTPCodecTypeVideo
}
func IsAudio(codecType webrtc.RTPCodecType) bool {
return codecType == webrtc.RTPCodecTypeAudio
}
type RTPCodec struct { type RTPCodec struct {
Name string Name string
PayloadType webrtc.PayloadType PayloadType webrtc.PayloadType
@ -72,6 +64,14 @@ func (codec RTPCodec) Register(engine *webrtc.MediaEngine) error {
}, codec.Type) }, 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 { func VP8() RTPCodec {
return RTPCodec{ return RTPCodec{
Name: "vp8", Name: "vp8",