Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy OpusCode returns null for .NET 4.7.2 #67

Open
mentalrob opened this issue Nov 27, 2022 · 3 comments
Open

Lazy OpusCode returns null for .NET 4.7.2 #67

mentalrob opened this issue Nov 27, 2022 · 3 comments

Comments

@mentalrob
Copy link

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

@Platratio34
Copy link

Platratio34 commented Jan 6, 2023

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

@Meetsch
Copy link
Collaborator

Meetsch commented Apr 26, 2023

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

@Meetsch
Copy link
Collaborator

Meetsch commented May 10, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants