Closed Firstmol closed 4 years ago
A cleaner way to solve this than the suggested PR (while still requiring minimal code changes) might be to add a ThreadLocal encode and decode options field to WebP class. Then wrap the native encode and decode calls in something like this
try {
decodeThreadLocal.set(aOptions);
int[] pixels = decode(aOptions.fPointer, aData, aOffset, aLength, aOut, ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN));
} finally {
decodeThreadLocal.remove();
}
The end result is the same, but this is a more explicit way of expressing what you're actually trying to do.
You can apply the same pattern wherever native objects need to be retained of course. I saw in the original PR that this was needed for aImage
in encode as well.
Thank you! I think it is not necessary for the aImage
(We discussed about that in the PR) .
@ediweissmann сould you post a new version to mavencentral repo pls? For now there is only 0.1.2 latest
thanks for the PR, 0.1.5 should be on it's way to Maven Central
Hello, I'm using the lib, but I got the error like here https://bitbucket.org/luciad/webp-imageio/issues/19/jvm-crash. @ediweissmann @pepijnve What do you think about that? Do you mind if I do an MR with a possible solution to this problem?