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

AudioStream::setBufferSizeInFrames returns an unrecognized Result #86

Closed
dturner opened this issue May 7, 2018 · 3 comments
Closed

Comments

@dturner
Copy link
Collaborator

dturner commented May 7, 2018

https://github.com/google/oboe/blob/master/src/aaudio/AudioStreamAAudio.cpp#L320

When using the AAudio API AudioStream::setBufferSizeInFrames is a wrapper for AAudioStream_setBufferSizeInFrames which returns an int. On success the int contains the new buffer size or on error contains a negative error number. This int is cast to an oboe::Result.

This represents a problem because in order to check whether the call was successful one must cast the oboe::Result back to an int and check whether it's negative. This breaks the pattern of doing if (result == Result::OK)

We should update setBufferSizeInFrames to return an oboe::ErrorOrValue

@philburk
Copy link
Collaborator

philburk commented May 7, 2018

The same issue applies to almost every get* for streams.
getFramesPerBurst() returns an int32_t frame count or a Result::ErrorNull.

https://github.com/google/oboe/blob/master/src/aaudio/AudioStreamAAudio.cpp#L350

Should setBufferSizeInFrames just return int32_t ?

Or should we change all of these functions to return ErrorOrValue ?
That seems like the right thing to do but will be very disruptive.

@dturner
Copy link
Collaborator Author

dturner commented May 8, 2018

See #87

@dturner
Copy link
Collaborator Author

dturner commented Jun 15, 2018

Fixed in #109

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