audioflinger: fix direct output underrun
Underruns on tracks handled by a direct or offloaded
threads were not properly reported to the applications
causing a failure to automatically recover.
Bug: 11535001.
Change-Id: I7a8696b4d646f78b16710addfe7c108d0dd0038d
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index b81183c..ba8195e 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -3673,6 +3673,9 @@
if (--(track->mRetryCount) <= 0) {
ALOGV("BUFFER TIMEOUT: remove(%d) from active list", track->name());
tracksToRemove->add(track);
+ // indicate to client process that the track was disabled because of underrun;
+ // it will then automatically call start() when data is available
+ android_atomic_or(CBLK_DISABLED, &cblk->mFlags);
} else if (last) {
mixerStatus = MIXER_TRACKS_ENABLED;
}
@@ -4094,6 +4097,9 @@
ALOGV("OffloadThread: BUFFER TIMEOUT: remove(%d) from active list",
track->name());
tracksToRemove->add(track);
+ // indicate to client process that the track was disabled because of underrun;
+ // it will then automatically call start() when data is available
+ android_atomic_or(CBLK_DISABLED, &cblk->mFlags);
} else if (last){
mixerStatus = MIXER_TRACKS_ENABLED;
}