discord-jda / JDA

Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Apache License 2.0
4.28k stars 735 forks source link

Recording Audion in the Channel and trying to write to a WAV file. #90

Closed TheCynosure closed 8 years ago

TheCynosure commented 8 years ago

We are developing a discord bot and we open the an audio connection and use an AudioReceiveHandler to record audio from the channel. Then when writing it to the wav or before we get this error with the JDA Library.

[17:32:54] [Fatal] [JDAAudioConn]: Encountered an exception:
java.lang.NegativeArraySizeException
    at net.dv8tion.jda.audio.Decoder.decodeFromOpus(Decoder.java:79)
    at net.dv8tion.jda.audio.AudioConnection$3.run(AudioConnection.java:366)
Almighty-Alpaca commented 8 years ago

This is clearly an issue on JDA's site. It's caused by the OpusDecoder having an error which we don't handle at all. As @DV8FromTheWorld made the audio receiving system a few days ago so he is probably the best guy for fixing it.

DV8FromTheWorld commented 8 years ago

This is only possible if the audio provided to JDA from Discord cannot properly be decoded by Opus. This error is now handled and a log message is sent at level TRACE. Fixed as of version: 2.2.0_337

TheCynosure commented 8 years ago

This is awesome, thank you!