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

Externalize opus binaries #659

Merged
merged 26 commits into from
Jun 3, 2018
Merged

Externalize opus binaries #659

merged 26 commits into from
Jun 3, 2018

Conversation

MinnDevelopment
Copy link
Member

@MinnDevelopment MinnDevelopment commented Apr 9, 2018

Pull Request Etiquette

There are several guidelines you should follow in order for your
Pull Request to be merged.

It is sometimes better to include more changes in a single commit.
If you find yourself having an overwhelming amount of commits, you
can rebase your branch.

Description

This should make the artifact easier to exclude and allows for a much smaller dependency.
Additionally we could offer audio support without the opus binaries (like lavaplayer which already does the opus encoding).

PS: We have to also publish the opus artifact to jcenter. https://bintray.com/minndevelopment/maven/opus-java

@MinnDevelopment
Copy link
Member Author

@DV8FromTheWorld Could you give some comments on this?

@ArsenArsen
Copy link
Contributor

You could also allow people to use the opus distributions that come with their systems (eg. libopus0 on Debian repositories, which provides /usr/lib/libopus.so.0)

The path should be provided to OpusLibrary.loadFrom(String) before
using the audio system.
The method will return true if the provided path could be loaded as
a library and false if it cannot or the system was already initialized.
@MinnDevelopment MinnDevelopment added status: completed has been completed but is not yet released and removed status: in progress already in the process of being implemented labels May 22, 2018
public static synchronized boolean loadFrom(String absolutePath)
{
if (initialized)
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this return audioSupported?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensureOpus() returns audioSupported because it is used by JDA to check whether the library is available or not. loadFrom() returns true if the library is loaded from that method invokation and false if not (it was already loaded).

if (AudioNatives.loadFrom("/lib/.../libopus.so")) {
    log.info("Loaded custom library at /lib/.../libopus.so");
} else {
    log.info("Opus binaries were already loaded, skipping.");
}

Copy link
Member

@DV8FromTheWorld DV8FromTheWorld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Good work.

@MinnDevelopment MinnDevelopment added this to the Release 3.7.0 milestone Jun 2, 2018
Cleanup javadoc exclude path
Updated README to suggest excluding opus-java by default,
the transitive JNA dependency makes a difference here
@MinnDevelopment MinnDevelopment merged commit 1af46b4 into development Jun 3, 2018
@MinnDevelopment MinnDevelopment deleted the patch-opus branch June 3, 2018 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: completed has been completed but is not yet released type: proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants