MumbleSharp icon indicating copy to clipboard operation
MumbleSharp copied to clipboard

Lazy OpusCode returns null for .NET 4.7.2

Open mentalrob opened this issue 2 years ago • 3 comments

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

mentalrob avatar Nov 27 '22 17:11 mentalrob

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()

Platratio34 avatar Jan 06 '23 19:01 Platratio34

Can you please check that opus.dll is copied over in the output Subfolder "\Audio\Codecs\Opus\Libs\32bit"

Meetsch avatar Apr 26 '23 09:04 Meetsch

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.

Meetsch avatar May 10 '23 13:05 Meetsch