Extreme lag spikes on Mac + Photon microphone + React on system changes enabled
Options
EranJ
✭
in Photon Voice
As per the title, when running on a Mac using the Photon microphone type and "React on system changes" enabled, the program halts to 1 FPS.
This doesn't happen with Unity microphone type, or on Windows, or with "React on system changes" disabled. I could only recreate it with all 3 of these conditions simultaneously.
The offender seems to be AudioSettings.InvokeOnAudioConfigurationChange which is called very frequently (even with no device change) and takes up 90% of frame time.
This doesn't happen with Unity microphone type, or on Windows, or with "React on system changes" disabled. I could only recreate it with all 3 of these conditions simultaneously.
The offender seems to be AudioSettings.InvokeOnAudioConfigurationChange which is called very frequently (even with no device change) and takes up 90% of frame time.
0
Comments
-
Hi @EranJ,
Could you replace "Recorder.OnAudioConfigChanged" with the following and try again:private void OnAudioConfigChanged(bool deviceWasChanged) { if (this.Logger.IsInfoEnabled) { this.Logger.LogInfo("OnAudioConfigChanged deviceWasChanged={0}", deviceWasChanged); } if (deviceWasChanged && this.IsRecording) { if (this.SourceType == InputSourceType.Microphone) { PhotonMicrophoneEnumerator.Refresh(); if (this.MicrophoneType == MicType.Photon) { this.RequiresRestart = !PhotonMicrophoneEnumerator.IDIsValid(this.photonMicrophoneDeviceId); } else { this.RequiresRestart = !IsValidUnityMic(this.unityMicrophoneDevice); } if (this.RequiresRestart) { this.RestartRecording(); } } } }
1 -
Will be able to test later in the week, currently everything is working very nicely with the Unity mic option and I'd rather not break it0