private void resetAllInstanseState() { this._WaveIn.RecordingStopped -= this.WaveInOnRecordingStopped; this._WaveIn.StopRecording(); this._WaveIn.Dispose(); this._WaveIn = null; if (GlobalConfiguration.isEncodeWithOpus && m_opusEncoder != null) { m_opusEncoder.Dispose(); m_opusEncoder = null; } //------ this._WaveIn = new WasapiLoopbackCapture(m_device); this._WaveIn.DataAvailable += this.WaveInOnDataAvailable; this._WaveIn.RecordingStopped += this.WaveInOnRecordingStopped; sdsock.ReListen(); Start(); // start capture and send stream }