Divide by zero

steamcore ✭✭
edited November 2019 in Photon Voice
Thought you guys would like to see, on my untiy analytics dashboard there's a user on a macbook that got this error when he changed microphone devices during play (plugged in mic headset I believe):
Photon.Voice.Unity.UnityAudioOut.Service () (at E:/Remotely/IPL.Photon/Assets/com.IPL.Photon/Dependencies/Photon/PhotonVoice/PhotonVoiceApi/Platforms/Unity/UnityAudioOut.cs:83)
Photon.Voice.AudioStreamPlayer`1[T].Service () (at E:/Remotely/IPL.Photon/Assets/com.IPL.Photon/Dependencies/Photon/PhotonVoice/PhotonVoiceApi/Core/AudioStreamPlayer.cs:55)
Photon.Voice.Unity.Speaker.Update () (at E:/Remotely/IPL.Photon/Assets/com.IPL.Photon/Dependencies/Photon/PhotonVoice/Code/Speaker.cs:166)


  • JohnTube
    JohnTube mod
    edited November 2019
    Hi @steamcore,

    Thank you for your report.
    We will investigate and fix this.
  • It's affecting multiple mac users now, here's number of exceptions from the past three days:

  • Hi @steamcore,

    What Unity version are you using?
    So to reproduce, we should plug in or out headphones on macOS to force speakers list to be updated?

    We will release a new version this week that includes the fix for the DivideByZeroException

    Thank you for your patience and understanding!
  • Hi @steamcore,

    I just submitted Photon Voice 2.12 to the Unity Asset Store.
    Make sure to update when it's out.

    Otherwise, make sure to enable "Recorder.ReactOnSystemChanges". I think it's useful.
  • A month ago I was getting 2000ms per frame on Mac with reactOnSystemChanges enabled. It was endlessly calling it as many times per frame as it possibly could.

    After I narrowed that down, I forgot to follow up here with a bug or report on my findings. Essentially I have an initial StartRecording only after I manually check all things are set up correctly (I do no auto start on the component either). Then when the drop-down is changed, or the list of devices changes, I set a flag of restart required on my own voice manager. Next frame it does a RestartRecording(), because I also noticed that doing on the same frame of RestartRequired didn't reliably enable / initialize new devices either on mac.

    Yeah so I've been having a real fight with it and haven't had the time to follow up here. I will update to latest and experiment with ReactOnSystemChanges again and report back, might be a few days though.
  • Hi @steamcore,

    Nice findings!
    Looking forward to reading more about this.

    Do not forget to share the Unity version you are using and minimal repro steps for the original DivideByZero exception, we want to investigate further even after fixing it.