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

BUG: src_get_channels returns wrong error #78

Closed
Flamefire opened this issue Jul 27, 2019 · 0 comments · Fixed by #80
Closed

BUG: src_get_channels returns wrong error #78

Flamefire opened this issue Jul 27, 2019 · 0 comments · Fixed by #80

Comments

@Flamefire
Copy link
Contributor

src_get_channels is supposed to "Returns negative on error, positive channel count otherwise"

But the implementation directly returns an error code which is positive. See https://github.com/erikd/libsamplerate/blob/2647fd9bac5f11f24b5f1ee55806671f81520f66/src/samplerate.c#L312 and https://github.com/erikd/libsamplerate/blob/2647fd9bac5f11f24b5f1ee55806671f81520f66/src/common.h#L64

Hence src_get_channels(NULL) returns 2 [channels] which is wrong

Flamefire added a commit to Flamefire/libsamplerate that referenced this issue Jul 29, 2019
Error codes returned are non-negative which confuses them with valid results.
Make sure the error code returned is inverted and hence negative.
Fixes libsndfile#78
@erikd erikd closed this as completed in #80 Jul 29, 2019
erikd pushed a commit that referenced this issue Jul 29, 2019
Error codes returned are non-negative which confuses them with valid results.
Make sure the error code returned is inverted and hence negative.
Fixes #78
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

Successfully merging a pull request may close this issue.

1 participant