fix: ensure that video buffers are empty before closing channels
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user