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

probably bug - NPE from Codec.java #16

Closed
ironhawk opened this issue Jul 6, 2014 · 4 comments
Closed

probably bug - NPE from Codec.java #16

ironhawk opened this issue Jul 6, 2014 · 4 comments

Comments

@ironhawk
Copy link

ironhawk commented Jul 6, 2014

Hi,
I just checked out compiled and ran the master
I got a NullPointerException from Codec.getInstalledCodecs() method, from line 258.

This is it:
String longName = codec.long_name().getString();

I had to change it to this:
String longName = codec.long_name() != null ? codec.long_name().getString() : "null";

Worked fine afterwards. Did anyone has this issue as well?

@ironhawk ironhawk changed the title NPE from Codec.java probably bug - NPE from Codec.java Jul 6, 2014
@saudet
Copy link
Member

saudet commented Jul 8, 2014

Hi, could you include a link to that Codec.getInstalledCodecs() method? Thanks!

@ironhawk
Copy link
Author

ironhawk commented Jul 9, 2014

What do you mean? I dont have any links. I just modified it locally...

Besides the above
I found other issues

in Configurable.java
/**
* Set new profile.
*
* @param profile new profile.
*/
public void setProfile(int profile) {
this.profile = bitrate;
}
why are we assigning bitrate?

in Encoder.java
this method

public void setSampleRate(int samplerate) throws JavaAVException {
    if (codec.getType() != MediaType.AUDIO)
        throw new JavaAVException("Cannot set sample rate for non-audio codec.");

    List<Integer> supportedRates = Arrays.asList(codec.getSupportedSampleRates());

    if (!supportedRates.contains(samplerate)) {
        // pick the highest supported sample rate
        samplerate = supportedRates.get(supportedRates.size() - 1);

        if (LOGGER.isWarnEnabled()) {
            LOGGER.warn("Sample rate {} is not supported by {}.", samplerate, getCodec().getName());
            LOGGER.warn("-> Selected supported sample rate {}.", samplerate);
        }
    }

I got index out of range exceptions because of this a couple of codecs returned empty supportedRates which is not checked
line
samplerate = supportedRates.get(supportedRates.size() - 1);
will fail

@saudet
Copy link
Member

saudet commented Jul 20, 2014

Where can I find the Configurable.java and Encoder.java files?

@saudet
Copy link
Member

saudet commented Dec 27, 2014

I'm guessing this is about JavaAV, so you should probably ask about that over there:
https://github.com/hoary/JavaAV/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants