fix memory leak on long run room/participant (#1169)

* Fix memory leak

* update pion

* clean code
This commit is contained in:
cnderrauber
2022-11-15 19:34:39 +08:00
committed by GitHub
parent bea1c77d05
commit a72cbea352
4 changed files with 34 additions and 16 deletions
+4 -1
View File
@@ -33,7 +33,10 @@ func (r *RTCPReader) OnClose(fn func()) {
}
func (r *RTCPReader) Close() error {
r.closed.Store(true)
if r.closed.Swap(true) {
return nil
}
r.onClose()
return nil
}