Opus Encoder Error : Channel must be stereo or mono

Im getting an error when trying to initialize the Opus encoder class in Unity3d 5.6 beta versions. The code works flawlessly on 5.5 and 5.4. I have tried b7-b9 and none of them work. Here are the error details. The project is for Daydream/GVR so we can only use 5.6 or above that has Daydream support

ArgumentOutOfRangeException: Must be Mono or Stereo Parameter name: numChannels POpusCodec.OpusEncoder..ctor (SamplingRate inputSamplingRateHz, Channels numChannels, Int32 bitrate, OpusApplicationType applicationType, Delay encoderDelay) (at Assets/Plugins/PhotonVoiceApi/Core/POpusCodec/OpusEncoder.cs:208) ExitGames.Client.Photon.Voice.LocalVoice..ctor (ExitGames.Client.Photon.Voice.VoiceClient voiceClient, Byte id, IAudioStreamBase audioStream, ExitGames.Client.Photon.Voice.VoiceInfo voiceInfo, Int32 channelId) (at Assets/Plugins/PhotonVoiceApi/Core/VoiceClient.cs:217) ExitGames.Client.Photon.Voice.LocalVoice`1[System.Single]..ctor (ExitGames.Client.Photon.Voice.VoiceClient voiceClient, Byte id, IAudioStream`1 audioStream, ExitGames.Client.Photon.Voice.VoiceInfo voiceInfo, Int32 channelId) (at Assets/Plugins/PhotonVoiceApi/Core/VoiceClient.cs:317) ExitGames.Client.Photon.Voice.LocalVoiceFloat..ctor (ExitGames.Client.Photon.Voice.VoiceClient voiceClient, Byte id, IAudioStream`1 audioStream, ExitGames.Client.Photon.Voice.VoiceInfo voiceInfo, Int32 channelId) (at Assets/Plugins/PhotonVoiceApi/Core/VoiceClient.cs:385) ExitGames.Client.Photon.Voice.VoiceClient.CreateLocalVoice (IAudioStreamBase audioStream, ExitGames.Client.Photon.Voice.VoiceInfo voiceInfo, Int32 channelId) (at Assets/Plugins/PhotonVoiceApi/Core/VoiceClient.cs:727) ExitGames.Client.Photon.Voice.LoadBalancingFrontend.CreateLocalVoice (IAudioStreamBase audioStream, ExitGames.Client.Photon.Voice.VoiceInfo voiceInfo) (at Assets/Plugins/PhotonVoiceApi/LoadBalancingFrontend.cs:152) PhotonVoiceNetwork.CreateLocalVoice (IAudioStreamFloat audioClip, ExitGames.Client.Photon.Voice.VoiceInfo voiceInfo) (at Assets/PUNVoice/Scripts/PhotonVoiceNetwork.cs:215) PhotonVoiceRecorder.Start () (at Assets/PUNVoice/Scripts/PhotonVoiceRecorder.cs:144)

The line that's throwing the exception is in OpusEncoder.cs:208

if ((numChannels != Channels.Mono)
&& (numChannels != Channels.Stereo))
{
throw new ArgumentOutOfRangeException("numChannels", "Must be Mono or Stereo");
}

Seems like the Encoder is not being initiated correctly. Would really appreciate some feedback on how to fix this. Please help. Thanks

Comments