MumbleSharp
MumbleSharp copied to clipboard
Lazy OpusCode returns null for .NET 4.7.2
protected internal IVoiceCodec GetCodec(SpeechCodecs codec)
{
switch (codec)
{
case SpeechCodecs.CeltAlpha:
return this._alpha.Value;
case SpeechCodecs.Speex:
return this._speex.Value;
case SpeechCodecs.CeltBeta:
return this._beta.Value;
case SpeechCodecs.Opus:
return this._opus.Value;
}
throw new ArgumentOutOfRangeException("codec");
I'm getting null pointer exception because of this._opus.Value
returns null in CodecSet.cs
I am getting something similar, so here is my stack trace:
System.Exception: BasicMumbleProtocol's _encodingThread was terminated unexpectedly because of a System.NullReferenceException
---> System.NullReferenceException: Object reference not set to an instance of an object.
at MumbleSharp.Audio.Codecs.Opus.OpusDecoder..ctor(Int32 outputSampleRate, Int32 outputChannelCount)
at MumbleSharp.Audio.Codecs.Opus.OpusCodec..ctor(Int32 sampleRate, Byte sampleBits, Byte channels, UInt16 frameSize)
at MumbleSharp.Audio.CodecSet.<>c__DisplayClass4_0.<.ctor>b__0()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at MumbleSharp.Audio.CodecSet.GetCodec(SpeechCodecs codec)
at MumbleSharp.Audio.AudioEncodingBuffer.Encode(SpeechCodecs codec)
at MumbleSharp.BasicMumbleProtocol.EncodingThreadEntry(Exception& exception)
--- End of inner exception stack trace ---
at MumbleSharp.BasicMumbleProtocol.<Initialise>b__40_1()
at System.Threading.Thread.StartCallback()
Can you please check that opus.dll is copied over in the output Subfolder "\Audio\Codecs\Opus\Libs\32bit"
The Nuget package has been updated to v2.0.1 so that the needed codecs files opus.dll are automatically copied to the output folder of projects referencing the nuget package, this should solve your issue. Please report if it did solve your issue or not, thanks.