fix: reset stereo encoder state when disabling stereo mode
DisableStereoEncoder now resets the stereo encoder so stale encoder state from one file playback session does not bleed into the next. Without this, the Opus encoder's internal state machine could produce a glitch at the start of the next file playback.
This commit is contained in:
committed by
Brandon McGinty
parent
cd968d7530
commit
676c27fe30
@@ -297,11 +297,16 @@ func (c *Client) EnableStereoEncoder() {
|
||||
c.useStereoEncoder = true
|
||||
}
|
||||
|
||||
// DisableStereoEncoder switches back to mono encoding for voice.
|
||||
// DisableStereoEncoder switches back to mono encoding for voice and
|
||||
// resets the stereo encoder so stale state does not bleed into the
|
||||
// next file playback.
|
||||
func (c *Client) DisableStereoEncoder() {
|
||||
c.volatile.Lock()
|
||||
defer c.volatile.Unlock()
|
||||
c.useStereoEncoder = false
|
||||
if c.AudioEncoderStereo != nil {
|
||||
c.AudioEncoderStereo.Reset()
|
||||
}
|
||||
}
|
||||
|
||||
// IsStereoEncoderEnabled returns true if stereo encoding is currently active.
|
||||
|
||||
Reference in New Issue
Block a user