Mac build issue.

Hello, we are using latest Unity and Latest Photon versions.
We are facing the bug on mac which told us:
"[WebRtcAudioDsp] OnAudioOutFrame channel count 1 != initialized 2. Switching channels and restarting"
Maybe someone can explain what does it mean?
Thanks. I'll provide any additional info if needed

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited March 2021
    Hi @Sasha,

    Thank you for choosing Photon!

    The error tells you that audio channels in WebRtcAudioDsp was initialized to 2 (stereo) but somehow the Unity audio listener is reporting 1 (mono) based on OnAudioFilterRead callback.

    This could mean that somehow audio config changes at runtime after recording started maybe because audio devices changed.

    Could be a Unity issue also.

    What Photon Voice version is this?
    What Unity version is this?
    What macOS version?
    Does this happen often? does the error repeat or is logged only once?
  • Sasha
    Sasha
    edited March 2021
    Hello @JohnTube ! Thanks for the answer!
    We are using:
    - Unity 2020.2.7f1 (Updated from latest 2019LTS because it wont built for Mac devices)
    - Photon voice 2.22.3 (I suppose)
    - MacOs latest BigSur
    We added WebRtcAudioDsp component because our voice chat wont work at all on mac without it.
    But this component now did another bug, that creating and closing audio from user on mac every second.
    Anyway, all works fine on windows build..
    Here is the video and screenshots of our components:
    https://drive.google.com/drive/folders/1DnENBciXWt5ToGfGK8GIBHytca3IYVf0?usp=sharing

    I am recording on windows in editor. The another person is sitting in the voice room from mac build.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited March 2021
    Hi @Sasha,

    We usually support LTS versions, 2020.3LTS is out now.

    WebRtcAudioDsp is optional, it's meant to make audio quality better. Not sure what you exactly mean "voice chat wont work at all on mac without it".
    Not sure what's wrong there (I still blame it on Unity).

    To unblock the situation, disable AEC from WebRtcAudioDsp, this should make the error go away. Photon microphone type already has built-in AEC (hence the Editor warning).
  • JohnTube
    JohnTube ✭✭✭✭✭
    After taking a deeper look at the video and the code of WebRtcAudioDsp, I don't think WebRtcAudioDsp can cause the Recorder to restart recording! Because that's what's happening, somehow the recorder is being restarted and this causes the outgoing voice stream ID/number to increase on each restart. On the receiving end the Speaker will be recreated or its name will change to reflect the newly created incoming voice stream.
    So please increase log level for Recorder and see why it keeps restarting, check stack trace for recording start logs.
  • Sasha
    Sasha
    edited March 2021
    Hello! Thanks a lot for help!!
    bug with creating and closing audio from user fixed.

    But we still can't beat the first one "[WebRtcAudioDsp] OnAudioOutFrame channel count 1 != initialized 2. Switching channels and restarting" error.

    We figured out that this error caused by using bluetooth headphones on mac. So with time voice starting interrupting a bit. Then some king of memory leaking and app crashes.

    (Also new error with time: "[PV] WebRTCAudioProcessor Reverse stream queue overflow")

    Maybe you can advice something else?
  • Hi,
    It seems like Unity audo output switches to mono after WebRtcAudioDsp initialization.
    Audio output mode can be set in Unity audio settings or via AudioSettings.speakerMode in runtime.
    Not sure if Unity can do this automatically when output device changes.
    Can you reproduce this with a demo from Voice package?