Skip to content

AAudio: add locks around reading and writing#1497

Merged
robertwu1 merged 6 commits intomainfrom
robertwu/testStreamStopWrite
Mar 23, 2022
Merged

AAudio: add locks around reading and writing#1497
robertwu1 merged 6 commits intomainfrom
robertwu/testStreamStopWrite

Conversation

@robertwu1
Copy link
Copy Markdown
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
Copy Markdown
Contributor

@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!

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

Thanks for the comments! I addressed all of them.

Comment thread tests/testStreamStop.cpp Outdated
@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