mirror of
https://github.com/m1k1o/neko.git
synced 2026-11-03 00:11:48 -06:00
fix: nil pointer panic when destroying webrtc peer in profileChanged (#695)
* This is a no-op with the default configuration: when only a single video pipeline is configured, there is nothing for the stream selector to switch to. The change only has an effect when the operator configures multiple pipelines and enables the bandwidth estimator. * fix(session): guard against nil WebRTC peer in profileChanged" --------- Co-authored-by: alvarorichard <alvarorichard@tuta.io>
This commit is contained in:
@@ -51,7 +51,11 @@ func (session *SessionCtx) profileChanged() {
|
|||||||
// otherwise webrtc destroy would trigger websocket reconnect. In case of kick event, webrtc destroy is called
|
// otherwise webrtc destroy would trigger websocket reconnect. In case of kick event, webrtc destroy is called
|
||||||
// before websocket destroy that delivers the information about the kick.
|
// before websocket destroy that delivers the information about the kick.
|
||||||
time.AfterFunc(time.Second, func() {
|
time.AfterFunc(time.Second, func() {
|
||||||
session.GetWebRTCPeer().Destroy()
|
// The peer may have been removed if the user disconnected while
|
||||||
|
// waiting for the delayed teardown.
|
||||||
|
if webrtcPeer := session.GetWebRTCPeer(); webrtcPeer != nil {
|
||||||
|
webrtcPeer.Destroy()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user