audiorecord_tests: Fix remaining threading issues

Protect access to shared variables. Also, add waiting
for receiving of asynchronous updates.

Bug: 329528237
Bug: 348658586
Test: atest --iterations=100 --test-filter="*TestGetSetMarker*" audiorecord_tests
Change-Id: I240f003427f0aadccc73a3df358ac81e2759cc6d
3 files changed