-
-
Notifications
You must be signed in to change notification settings - Fork 739
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
Implement AudioPacketInterceptor #425
Conversation
@@ -258,28 +266,33 @@ else if (sendHandler == null && sendSystem != null) | |||
|
|||
private synchronized void setupReceiveSystem() | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation initializes the receive thread even if there is only an AudioPacketInterceptor, but no ReceiveHandler.
I have tried to cleanup this setup routine as much as I could, but I would appreciate a second pair of eyes checking on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With your changes, if there is a "consumer" but the socket is either null or closed, nothing happens.
In the old implementation, if the socket was null/closed (no matter if "consumer" is set, there was cleanup (your else branch)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I did not spot that!
I think it does not make a difference in this case tough, the combined audio thread only gets setup when the udpSocket is not null, so there is nothing to clean up.
This PR is on hold until voice resume has been merged. On a side note, you need to update your code style to fit into JDA, the wiki explains this. |
I have fixed the teardown and style issues |
I'm assigning this to @DV8FromTheWorld so he can decide how we should implement this. |
Closing this, so @DV8FromTheWorld can use the issue to decide on an implementation. This PR is not satisfying. |
Implemented a new interface for AudioPacketInterceptor.
This object can be registered just like an AudioReceiveHandler, but it provides a much more low level access to audio packets than the standard handleUserAudio callback.
Also allows discarding AudioPackets, effectively hiding them from the JDA backend.
This PR implements issue #418