Release audio resources before reconnecting
This commit is contained in:
committed by
Brandon McGinty
parent
25467405b8
commit
d07d7342da
+17
@@ -81,6 +81,23 @@ type Barnard struct {
|
||||
adminACL *gumble.ACL
|
||||
}
|
||||
|
||||
// cleanupConnectionAudio releases connection-owned audio resources before a
|
||||
// reconnect replaces them. It is intentionally idempotent for repeated
|
||||
// disconnect notifications.
|
||||
func (b *Barnard) cleanupConnectionAudio() {
|
||||
if b.Stream != nil {
|
||||
stream := b.Stream
|
||||
b.Stream = nil
|
||||
stream.Destroy()
|
||||
}
|
||||
b.FileStreamMutex.Lock()
|
||||
if b.FileStream != nil {
|
||||
_ = b.FileStream.Stop()
|
||||
b.FileStream = nil
|
||||
}
|
||||
b.FileStreamMutex.Unlock()
|
||||
}
|
||||
|
||||
func (b *Barnard) StopTransmission() {
|
||||
if b.Tx {
|
||||
b.Notify("micdown", "me", "")
|
||||
|
||||
Reference in New Issue
Block a user