mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-30 19:26:24 +08:00
Fix empty streams json on stream lock
This commit is contained in:
@@ -198,8 +198,12 @@ producers:
|
||||
//}
|
||||
|
||||
func (s *Stream) MarshalJSON() ([]byte, error) {
|
||||
if !s.mu.TryLock() {
|
||||
log.Warn().Msgf("[streams] json locked")
|
||||
return []byte(`null`), nil
|
||||
}
|
||||
|
||||
var v []interface{}
|
||||
s.mu.Lock()
|
||||
for _, prod := range s.producers {
|
||||
if prod.element != nil {
|
||||
v = append(v, prod.element)
|
||||
|
||||
Reference in New Issue
Block a user