AAudio: Use futex for waitForStateChange

WaitForStateChange currently waits in twenty millisecond intervals
for state changes. This is clearly inefficient and if apps use this
consistently, much extra latency is added. This CL adds futexes so
the callback fires almost immediately after a state change.

This CL also changes updateStateMachine so updates from non-callbacks
do not happen if a callback thread is running.

Bug: 70722092
Test: atest AAudioTests
Test: Oboe automated tests (./run_tests.sh)
Test: OboeTester Plug Latency Test
Change-Id: I186dc9ddac7f3897d82a5ed0043a5f45f1c19fe3
9 files changed