修复 rtsp 推流一个低级错误

This commit is contained in:
langhuihui
2024-07-29 20:41:22 +08:00
parent bc17976582
commit 17241550bb
12 changed files with 72 additions and 33 deletions

View File

@@ -100,6 +100,19 @@ func (c *Collection[K, T]) Get(key K) (item T, ok bool) {
return
}
func (c *Collection[K, T]) Find(f func(T) bool) (item T, ok bool) {
if c.L != nil {
c.L.RLock()
defer c.L.RUnlock()
}
for _, item = range c.Items {
if f(item) {
return item, true
}
}
return
}
func (c *Collection[K, T]) GetKey() K {
return c.Items[0].GetKey()
}