eoryl / DiscordAudioStream

An audio streaming tool for Discord based on Discord.net and NAudio
MIT License
10 stars 2 forks source link

App Crashes after Long Sessions (~3 hours) #3

Open dondonini opened 1 year ago

dondonini commented 1 year ago

I would be listening to the bot, but after some time I would hear subtle pauses in the stream then eventually the app would close/crash with no warnings.

Here are the events I get from Event Viewer if this helps:

Faulting application name: DiscordAudioStream.exe, version: 1.0.12.0, time stamp: 0xafe556f8
Faulting module name: clr.dll, version: 4.8.4515.0, time stamp: 0x624cf48c
Exception code: 0xc0000409
Fault offset: 0x0065d4c8
Faulting process id: 0xe44
Faulting application start time: 0x01d8cd1728a3850a
Faulting application path: C:\Program Files (x86)\DiscordAudioStream\DiscordAudioStream.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report Id: 99026ea6-023b-4ab5-aba0-fb992902afe1
Faulting package full name: 
Faulting package-relative application ID: 
Application: DiscordAudioStream.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
   at Discord.Audio.OpusEncoder.Encode(IntPtr, Byte*, Int32, Byte*, Int32)
   at Discord.Audio.OpusEncoder.EncodeFrame(Byte[], Int32, Byte[], Int32)
   at Discord.Audio.Streams.OpusEncodeStream+<WriteAsync>d__8.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Discord.Audio.Streams.OpusEncodeStream+<WriteAsync>d__8, Discord.Net.WebSocket, Version=3.7.2.0, Culture=neutral, PublicKeyToken=null]](<WriteAsync>d__8 ByRef)
   at Discord.Audio.Streams.OpusEncodeStream.WriteAsync(Byte[], Int32, Int32, System.Threading.CancellationToken)
   at System.IO.Stream.WriteAsync(Byte[], Int32, Int32)
   at DiscordAudioStreamService.AudioStreamingService+<TransmitAudioBufferAsync>d__104.MoveNext()
   at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[[DiscordAudioStreamService.AudioStreamingService+<TransmitAudioBufferAsync>d__104, DiscordAudioStreamService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]](<TransmitAudioBufferAsync>d__104 ByRef)
   at DiscordAudioStreamService.AudioStreamingService.TransmitAudioBufferAsync(Single[], Int32)
   at DiscordAudioStreamService.AudioStreamingService.Audioin_DataAvailable(System.Object, NAudio.Wave.WaveInEventArgs)
   at NAudio.Wave.WaveIn.RaiseDataAvailable(NAudio.Wave.WaveInBuffer)
   at NAudio.Wave.WaveIn.Callback(IntPtr, WaveMessage, IntPtr, NAudio.Wave.WaveHeader, IntPtr)
   at NAudio.Wave.WaveWindow.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
   at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
   at System.Windows.Forms.Application.Run(System.Windows.Forms.Form)
   at DiscordAudioStream.Program.Main()

System specs:

OS: Windows 10 Pro x64
Processor: Intel Core i5 660 @ 3.33GHz
RAM: 4GB DDR3
GPU: NVIDIA GeForce GT 1030
eoryl commented 1 year ago

Thanks. That error happens down in the opus codec, I'll update opus.dll to a version compiled from the latest stable release source code from https://opus-codec.org/ in the next version.