Merge "AudioFlinger: Update latency method thread safety" into main
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 0f1aab0..d7fbb9e 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2678,7 +2678,7 @@
// cover audio hardware latency.
// This is probably too conservative, but legacy application code may depend on it.
// If you change this calculation, also review the start threshold which is related.
- uint32_t latencyMs = latency_l();
+ uint32_t latencyMs = latency();
if (latencyMs == 0) {
ALOGE("Error when retrieving output stream latency");
lStatus = UNKNOWN_ERROR;
@@ -2883,8 +2883,6 @@
return latency_l();
}
uint32_t PlaybackThread::latency_l() const
-NO_THREAD_SAFETY_ANALYSIS
-// Fix later.
{
uint32_t latency;
if (initCheck_l() == NO_ERROR && mOutput->stream->getLatency(&latency) == OK) {
@@ -3134,8 +3132,10 @@
return mOutput->stream->selectPresentation(presentationId, programId);
}
-void PlaybackThread::ioConfigChanged_l(audio_io_config_event_t event, pid_t pid,
- audio_port_handle_t portId) {
+void PlaybackThread::ioConfigChanged_l(
+ audio_io_config_event_t event, pid_t pid, audio_port_handle_t portId)
+ NO_THREAD_SAFETY_ANALYSIS // TODO(b/420918374) fix
+{
ALOGV("PlaybackThread::ioConfigChanged, thread %p, event %d", this, event);
sp<AudioIoDescriptor> desc;
const struct audio_patch patch = isMsdDevice() ? mDownStreamPatch : mPatch;
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index 3755461..2948819 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -1146,9 +1146,9 @@
public:
// return estimated latency in milliseconds, as reported by HAL
- uint32_t latency() const final;
+ uint32_t latency() const final EXCLUDES_ThreadBase_Mutex;
// same, but lock must already be held
- uint32_t latency_l() const final /* REQUIRES(mutex()) */; // NO_THREAD_SAFETY_ANALYSIS
+ uint32_t latency_l() const final REQUIRES(mutex());
// VolumeInterface
void setMasterVolume(float value) final;