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

opus_decode_float binding is incorrect #785

Closed
unascribed opened this issue Jul 27, 2022 · 1 comment
Closed

opus_decode_float binding is incorrect #785

unascribed opened this issue Jul 27, 2022 · 1 comment

Comments

@unascribed
Copy link

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):

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.

Stacktrace or crash log output

No response

@Spasi
Copy link
Member

Spasi commented Jul 28, 2022

Thank you @unascribed!

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

No branches or pull requests

2 participants