AudioFlinger: Use audio_utils::mutex
Test: atest AudioTrackTest AudioRecordTest
Test: atest AAudioTests AudioTrackOffloadTest
Test: atest AudioPlaybackCaptureTest
Test: Camera YouTube
Bug: 298534151
Change-Id: Iba9e1e8f6d5f9ad2e31ea4e09598f2829ece3f02
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 157764f..3e0cb16 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2901,7 +2901,7 @@
{
// TODO(b/184194780): Use the vibrator information from the vibrator that will be
// used to play this track.
- Mutex::Autolock _l(mAfThreadCallback->mutex());
+ audio_utils::lock_guard _l(mAfThreadCallback->mutex());
vibratorInfo = std::move(mAfThreadCallback->getDefaultVibratorInfo_l());
}
mLock.lock();
@@ -3957,7 +3957,7 @@
if (isMsdDevice() && outDeviceTypes().count(AUDIO_DEVICE_OUT_BUS) != 0) {
// Here, we try for the AF lock, but do not block on it as the latency
// is more informational.
- if (mAfThreadCallback->mutex().tryLock() == NO_ERROR) {
+ if (mAfThreadCallback->mutex().try_lock()) {
std::vector<SoftwarePatch> swPatches;
double latencyMs = 0.; // not required; initialized for clang-tidy
status_t status = INVALID_OPERATION;