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

AAudio: add locks around reading and writing #1497

Merged
merged 6 commits into from
Mar 23, 2022

Conversation

robertwu1
Copy link
Collaborator

@robertwu1 robertwu1 commented Mar 3, 2022

This PR fixes an issue where AAudio segfaults if the stream is closed while read or write occurs. The main work done here is a 2 line change adding shared locks for read and write. This is relatively safe as these locks are only used as exclusive for close(), which should wait for all operations to finish in the first place.

I've updated a few things related to unit tests.

  1. The unit tests to use a newer version of gradle.
  2. I added tests to account to test the new AAudio shared read/write locks.
  3. Unit tests wouldn't run for devices built with hardware sanitizer, so I've added a check.

Fixes #1484

@robertwu1 robertwu1 requested a review from philburk March 3, 2022 01:13
Copy link
Collaborator

@philburk philburk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

tests/testStreamStop.cpp Outdated Show resolved Hide resolved
tests/testStreamStop.cpp Outdated Show resolved Hide resolved
tests/testStreamStop.cpp Outdated Show resolved Hide resolved
tests/testStreamStop.cpp Outdated Show resolved Hide resolved
tests/testStreamStop.cpp Outdated Show resolved Hide resolved
@robertwu1 robertwu1 requested a review from philburk March 3, 2022 19:58
@robertwu1
Copy link
Collaborator Author

Thanks for the comments! I addressed all of them.

tests/testStreamStop.cpp Outdated Show resolved Hide resolved
@robertwu1 robertwu1 requested a review from philburk March 17, 2022 16:17
@robertwu1 robertwu1 merged commit 6adcc5d into main Mar 23, 2022
@robertwu1 robertwu1 deleted the robertwu/testStreamStopWrite branch April 6, 2022 18:25
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 this pull request may close these issues.

Crashes in oboe::AudioStreamAAudio::read(void*, int, long) [AudioStreamAAudio.cpp:490]
2 participants