commit | 98b8d45c4915ba35078bb07ee2d10ad42dd939a1 | [log] [tgz] |
---|---|---|
author | Jiabin Huang <jiabin@google.com> | Thu Jan 04 18:42:55 2024 +0000 |
committer | Android Build Cherrypicker Worker <android-build-cherrypicker-worker@google.com> | Thu Jan 04 18:42:55 2024 +0000 |
tree | 2fb60ca3dc05e1aeedcdeca706e7861c849441f2 | |
parent | d85f78418056b418de3161cd385cdee6aac02166 [diff] [blame] |
Add RWLock when accessing tee patches. Bug: 314041707 Test: atest AudioPlaybackCaptureTest (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:73f9705e6ede00d224047736a8cb31e7790f2f7d) Merged-In: I3d6e7d434a983c869e3523687e5fb5cb67a253af Change-Id: I3d6e7d434a983c869e3523687e5fb5cb67a253af
diff --git a/services/audioflinger/PlaybackTracks.h b/services/audioflinger/PlaybackTracks.h index ae60ed0..2577ca8 100644 --- a/services/audioflinger/PlaybackTracks.h +++ b/services/audioflinger/PlaybackTracks.h
@@ -23,6 +23,7 @@ #include <audio_utils/mutex.h> #include <audio_utils/LinearMap.h> #include <binder/AppOpsManager.h> +#include <utils/RWLock.h> namespace android { @@ -352,6 +353,7 @@ // Must hold thread lock to access tee patches template <class F> void forEachTeePatchTrack_l(F f) { + RWLock::AutoRLock readLock(mTeePatchesRWLock); for (auto& tp : mTeePatches) { f(tp.patchTrack); } }; @@ -387,6 +389,7 @@ audio_output_flags_t mFlags; TeePatches mTeePatches; std::optional<TeePatches> mTeePatchesToUpdate; + RWLock mTeePatchesRWLock; const float mSpeed; const bool mIsSpatialized; const bool mIsBitPerfect;