Dear All,
firstly, I am sorry to trouble you for a Andriod Audio issue.
in AudioTrackShared.cpp, for a recording case, we met below issue:
recording case met overrun, so the inputThread will sleep a while, but AudioRecrodThread will continue to run and block at mCblk->mFutex.
if right now, user stop the recording, and the inputThread has no chance to release mFutext, then to standby.
And the client's interrupt was just called right before AudioRecordThread's obtainBbuffer try to wait mCblk->mFutex.
@@ -209,13 +209,18 @@ status_t ClientProxy::obtainBuffer(Buffer* buffer, const struct timespec *reques
}
int32_t old = android_atomic_and(~CBLK_FUTEX_WAKE, &cblk->mFutex);
if (!(old & CBLK_FUTEX_WAKE)) {
int rc;
if (measure && !beforeIsValid) {
clock_gettime(CLOCK_MONOTONIC, &before);
beforeIsValid = true;
}
int ret = __futex_syscall4(&cblk->mFutex,
mClientInServer ? FUTEX_WAIT_PRIVATE : FUTEX_WAIT, old & ~CBLK_FUTEX_WAKE, ts);
Then we will find that AudioRecrodThread will always be blocked, because RecordTrack's destory will also miss the wake mCblk->mFutex, for it was already Interrupted before.
So I wonder why has below CBLC_INTERRUPT condition judgement before wake, Could we just remove it ?
void ClientProxy::interrupt()
{
audio_track_cblk_t* cblk = mCblk;
if (!(android_atomic_or(CBLK_INTERRUPT, &cblk->mFlags) & CBLK_INTERRUPT)) {
(void) __futex_syscall3(&cblk->mFutex, mClientInServer ? FUTEX_WAKE_PRIVATE : FUTEX_WAKE,
1);
}
}
Thanks