audioflinger: fix lost offload thread resume event
It was possible that a resume request signaled by addTrack_l()
while waiting for an async write callback is lost. This is because
mSignalPending was not set and waitingAsyncCallback_l() would pause the
thread loop before executing prepareTracks_l().
The fix consists in using signal_l() method to wake the thread
loop o that mSignalPending is set.
Also make sure that sleepTime is reset to 0 when resuming to make sure
that we write any remaining bytes to the HAL.
Bug: 10810347.
Change-Id: If9a3b22cc3b9e6eb384a56c48c40e6258d0896ad
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 57aad1e..2b8f0ab 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -651,7 +651,7 @@
case RESUMING:
mState = PAUSING;
ALOGV("ACTIVE/RESUMING => PAUSING (%d) on thread %p", mName, thread.get());
- playbackThread->signal_l();
+ playbackThread->broadcast_l();
break;
default:
@@ -711,7 +711,7 @@
// before mixer thread can run. This is important when offloading
// because the hardware buffer could hold a large amount of audio
playbackThread->flushOutput_l();
- playbackThread->signal_l();
+ playbackThread->broadcast_l();
}
}