webrtc statsStop in diesconnect function.

This commit is contained in:
Miroslav Šedivý 2022-02-12 18:39:26 +01:00
parent 37b0a82167
commit 53a78140ea

View File

@ -306,6 +306,11 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
this._peer = undefined this._peer = undefined
} }
if (this._statsStop && typeof this._statsStop === 'function') {
this._statsStop()
this._statsStop = undefined
}
this._track = undefined this._track = undefined
this._state = 'disconnected' this._state = 'disconnected'
this._connected = false this._connected = false
@ -459,11 +464,6 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
this._log.info(`disconnected`, { error }) this._log.info(`disconnected`, { error })
this.emit('disconnected', error) this.emit('disconnected', error)
this._connected = false this._connected = false
if (this._statsStop && typeof this._statsStop === 'function') {
this._statsStop()
this._statsStop = undefined
}
} }
private statsEmitter(ms: number = 2000) { private statsEmitter(ms: number = 2000) {