Add media filter for RTSP source #198

This commit is contained in:
Alexey Khit
2023-08-21 14:07:07 +03:00
parent f80f179e4c
commit 69a3a30a0e
3 changed files with 12 additions and 0 deletions
+10
View File
@@ -147,6 +147,16 @@ func (c *Conn) Describe() error {
return err
}
if c.Media != "" {
clone := make([]*core.Media, 0, len(medias))
for _, media := range medias {
if strings.Contains(c.Media, media.Kind) {
clone = append(clone, media)
}
}
medias = clone
}
// TODO: rewrite more smart
if c.Medias == nil {
c.Medias = medias