fix: ensure that video buffers are empty before closing channels

This commit is contained in:
Charles Hathaway
2024-01-19 00:43:16 -08:00
parent 84eb188ada
commit 1a3f01ae03
11 changed files with 13 additions and 65 deletions
+7
View File
@@ -139,6 +139,13 @@ func (v *Video) Join() (<-chan []byte, string, func()) {
v.mu.Lock()
defer v.mu.Unlock()
// Close the channel
close(v.ivfListeners[myID])
// Consume any pending frames
for _ := range v.ivfListeners[myID] {
// do nothing
}
delete(v.ivfListeners, myID)
}
}