amsam0 / voicechat-discord

A mod and plugin to make a bridge between Simple Voice Chat and Discord to allow for players without the mod to hear and speak.
https://modrinth.com/mod/simple-voice-chat-discord-bridge
MIT License
24 stars 7 forks source link

Issues on bad connection #5

Closed MatadorProBr closed 1 year ago

MatadorProBr commented 1 year ago

Sometimes (principally if you network dies for a brief moment), the voice chat plugin just stops receiving the audio data of the Discord player, which causes the disconnect icon on their name and the only way to fix this is making the Discord player rejoin the server and use the command again which is very exhaustive (principally for a Geyser player)

Here is a example log: [23:11:35 WARN]: Exception in thread "AudioPlayer-(uuid)" java.lang.AssertionError [23:11:35 WARN]: at voicechat-bukkit-1.19.3-2.3.24.jar//de.maxhenkel.voicechat.concentus.Inlines.OpusAssert(Inlines.java:40) [23:11:35 WARN]: at voicechat-bukkit-1.19.3-2.3.24.jar//de.maxhenkel.voicechat.concentus.PitchAnalysisCore.silk_pitch_analysis_core(PitchAnalysisCore.java:554) [23:11:35 WARN]: at voicechat-bukkit-1.19.3-2.3.24.jar//de.maxhenkel.voicechat.concentus.FindPitchLags.silk_find_pitch_lags(FindPitchLags.java:147) [23:11:35 WARN]: at voicechat-bukkit-1.19.3-2.3.24.jar//de.maxhenkel.voicechat.concentus.SilkChannelEncoder.silk_encode_frame(SilkChannelEncoder.java:928) [23:11:35 WARN]: at voicechat-bukkit-1.19.3-2.3.24.jar//de.maxhenkel.voicechat.concentus.EncodeAPI.silk_Encode(EncodeAPI.java:524) [23:11:35 WARN]: at voicechat-bukkit-1.19.3-2.3.24.jar//de.maxhenkel.voicechat.concentus.OpusEncoder.opus_encode_native(OpusEncoder.java:987) [23:11:35 WARN]: at voicechat-bukkit-1.19.3-2.3.24.jar//de.maxhenkel.voicechat.concentus.OpusEncoder.encode(OpusEncoder.java:1312) [23:11:35 WARN]: at voicechat-bukkit-1.19.3-2.3.24.jar//de.maxhenkel.voicechat.plugins.impl.opus.JavaOpusEncoderImpl.encode(JavaOpusEncoderImpl.java:43) [23:11:35 WARN]: at voicechat-bukkit-1.19.3-2.3.24.jar//de.maxhenkel.voicechat.plugins.impl.audiochannel.AudioPlayerImpl.run(AudioPlayerImpl.java:79)

amsam0 commented 1 year ago

Thanks for reporting this! I'll look into it.

amsam0 commented 1 year ago

Is there any more of the error message that you didn't already send? It seems like some parts of it were cut off (there is no mention of my plugin). Also, did you blank out the uuid with (uuid), or is that what's in the actual error message?

MatadorProBr commented 1 year ago

Is there any more of the error message that you didn't already send? It seems like some parts of it were cut off (there is no mention of my plugin). Also, did you blank out the uuid with (uuid), or is that what's in the actual error message?

Didn't see any other error, the rest just seems to be normal logs, I will check it today if there is something more that I forgot to add and yes, it's a UUID so I blanked it, more precisely, a UUID from a Geyser player

amsam0 commented 1 year ago

Alright, thanks. It seems like some of the error log was cut off and this also seems like an issue that would be very hard for me to reproduce so it's hard to figure out what's causing it.

amsam0 commented 1 year ago

Oops, looks like the commit message auto closed it.

@MatadorProBr I’ve made a possible fix, could you try using this nightly build: https://github.com/naturecodevoid/voicechat-discord/actions/runs/4030522081

Scroll down to artifacts and download the one for your platform (you’ll have to extract the zip to get the jar file). Please tell me if it fixes it so I can make a new stable release.

amsam0 commented 1 year ago

Hey @MatadorProBr, sorry to bug you but could you try the nightly build and see if it fixes the issue? 1.5.0 has a lot of other improvements and it’s currently waiting on this issue.

MatadorProBr commented 1 year ago

Oh sure, I will try probably today but no promises since nobody seems to be wanting to play Minecraft again and trying myself will probably be somewhat hard

MatadorProBr commented 1 year ago

Restarted the router various time and joined using the public IP and it gave this warn: [13:50:54 WARN]: [dev.naturecodevoid.voicechatdiscord.shadow.jda.internal.audio.AudioWebSocket] Failed to establish websocket connection to wss://brazil8794.discord.media:443?v=4: SOCKET_CONNECT_ERROR - Failed to resolve hostname brazil8794.discord.media:443: Este host não é conhecido (brazil8794.discord.media) Closing connection and attempting to reconnect

and seeing it doesn't seem to be relatable with the issue I originally send, it sounds more a error when your router can't make a connection to the Discord websocket at all so yeah, I can't reproduce it for now until one of my friends starts playing on the server again using Discord

amsam0 commented 1 year ago

Thanks for the reply! I've actually been getting that error during development and I had to use a separate machine to test. Could you see if it happens on 1.4.0? Wondering if it's caused by some change I made. (I updated the JDA dependency but even when I went back to the version 1.4.0 uses it still happened)

MatadorProBr commented 1 year ago

Got this issue now that literally spams the console on the 1.4.0 version: [ERROR]: [dev.naturecodevoid.voicechatdiscord.shadow.jda.api.audio.factory.DefaultSendSystem] Uncaught exception in audio send thread java.lang.AssertionError: null at de.maxhenkel.voicechat.concentus.Inlines.OpusAssert(Inlines.java:40) ~[voicechat-bukkit-1.19.3-2.3.24.jar:?] at de.maxhenkel.voicechat.concentus.Resampler.silk_resampler(Resampler.java:196) ~[voicechat-bukkit-1.19.3-2.3.24.jar:?] at de.maxhenkel.voicechat.concentus.EncodeAPI.silk_Encode(EncodeAPI.java:312) ~[voicechat-bukkit-1.19.3-2.3.24.jar:?] at de.maxhenkel.voicechat.concentus.OpusEncoder.opus_encode_native(OpusEncoder.java:987) ~[voicechat-bukkit-1.19.3-2.3.24.jar:?] at de.maxhenkel.voicechat.concentus.OpusEncoder.encode(OpusEncoder.java:1312) ~[voicechat-bukkit-1.19.3-2.3.24.jar:?] at de.maxhenkel.voicechat.plugins.impl.opus.JavaOpusEncoderImpl.encode(JavaOpusEncoderImpl.java:43) ~[voicechat-bukkit-1.19.3-2.3.24.jar:?] at dev.naturecodevoid.voicechatdiscord.DiscordAudioHandler.provide20MsAudio(DiscordAudioHandler.java:45) ~[voicechat-discord-paper-1.4.0.jar:?] at dev.naturecodevoid.voicechatdiscord.shadow.jda.internal.audio.AudioConnection$PacketProvider.getNextPacketRaw(AudioConnection.java:676) ~[voicechat-discord-paper-1.4.0.jar:?] at dev.naturecodevoid.voicechatdiscord.shadow.jda.internal.audio.AudioConnection$PacketProvider.getNextPacket(AudioConnection.java:663) ~[voicechat-discord-paper-1.4.0.jar:?] at dev.naturecodevoid.voicechatdiscord.shadow.jda.api.audio.factory.DefaultSendSystem.lambda$start$0(DefaultSendSystem.java:69) ~[voicechat-discord-paper-1.4.0.jar:?] at java.lang.Thread.run(Thread.java:833) ~[?:?]

amsam0 commented 1 year ago

Could you try 1.5.0? Go to the actions tab and download the latest build for your platform

MatadorProBr commented 1 year ago

Now I'm facing another issue, trying to use the /startdiscordvoicechat command with the 1.5.0 version nothing happens, on the console it shows that I issued the command but nothing happen and no errors/warns appear. [18:15:19 INFO]: MatadorProBr1 issued server command: /startdiscordvoicechat

Using on console gives a error (I think it's normal since the plugin probably doesn't know what to do when it's not executed by a player) org.bukkit.command.CommandException: Unhandled exception executing 'startdiscordvoicechat' in dev.naturecodevoid.voicechatdiscord.PluginBrigadierCommand(startdiscordvoicechat) at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:178) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_19_R2.CraftServer.dispatchCommand(CraftServer.java:982) ~[purpur-1.19.3.jar:git-Purpur-1916] at github.scarsz.discordsrv.listeners.DiscordConsoleListener.lambda$onGuildMessageReceived$0(DiscordConsoleListener.java:112) ~[DiscordSRV-Build-1.26.0.jar:?] at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.19.3.jar:git-Purpur-1916] at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[purpur-1.19.3.jar:git-Purpur-1916] at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1500) ~[purpur-1.19.3.jar:git-Purpur-1916] at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:488) ~[purpur-1.19.3.jar:git-Purpur-1916] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1424) ~[purpur-1.19.3.jar:git-Purpur-1916] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1194) ~[purpur-1.19.3.jar:git-Purpur-1916] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:321) ~[purpur-1.19.3.jar:git-Purpur-1916] at java.lang.Thread.run(Thread.java:833) ~[?:?] Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: net.minecraft.server.dedicated.DedicatedServer.getCommands() at dev.naturecodevoid.voicechatdiscord.PluginBrigadierCommand.execute(PluginBrigadierCommand.java:62) ~[voicechat-discord-paper-1.4.0-nightly.bb85e2c33969d00c48b5fa736d6c21558f59273b.jar:?] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?] ... 10 more Caused by: java.lang.NoSuchMethodException: net.minecraft.server.dedicated.DedicatedServer.getCommands() at java.lang.Class.getMethod(Class.java:2227) ~[?:?] at dev.naturecodevoid.voicechatdiscord.PluginBrigadierCommand.execute(PluginBrigadierCommand.java:52) ~[voicechat-discord-paper-1.4.0-nightly.bb85e2c33969d00c48b5fa736d6c21558f59273b.jar:?] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?] ... 10 more

amsam0 commented 1 year ago

I see. I will have to investigate, looks like one of the things I added is not working. I am currently busy with some other projects, so it might be a while before I get to fixing this and adding group support.

amsam0 commented 1 year ago

should be fixed with 2.0.0/new nightly builds, please reopen if not