public void StopPlaying() { if (playing == false) { return; } if (avPlayer != null) { avPlayer.Stop(); avPlayer = null; } if (otherPlayer != null) { otherPlayer.Stop(); otherPlayer = null; } if (this.perfCounter != null) { perfCounter.Dispose(); } lock (this) { if (rtpSession != null) { rtpSession.Dispose(); rtpSession = null; } playing = false; } }