LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
The opus_decode_float binding is incorrect, taking a ShortBuffer with a claimed native type of opus_int16* instead of a FloatBuffer (formatting mine):
public static int opus_decode_float(
@NativeType("OpusDecoder *") long st,
@Nullable @NativeType("unsigned char const *") ByteBuffer data,
@NativeType("opus_int16 *") ShortBuffer pcm,
int frame_size,
int decode_fec
) {
The equivalent native header:
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decode_float(
OpusDecoder *st,
const unsigned char *data,
opus_int32 len,
float *pcm,
int frame_size,
int decode_fec
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
pcm is clearly a float* and should be bound as a FloatBuffer.
This makes the "safe" API unusable due to the mismatch between the size of a short and a float.
Workaround for now is to use nopus_decode_float directly.
Version
3.3.2 (nightly), 3.3.1
Platform
Linux x64
JDK
Arch OpenJDK 17.0.4
Module
Opus
Bug description
The
opus_decode_float
binding is incorrect, taking a ShortBuffer with a claimed native type of opus_int16* instead of a FloatBuffer (formatting mine):The equivalent native header:
pcm
is clearly a float* and should be bound as a FloatBuffer.This makes the "safe" API unusable due to the mismatch between the size of a short and a float.
Workaround for now is to use nopus_decode_float directly.
Stacktrace or crash log output
No response