auto import from //branches/cupcake/...@137197
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index 5416629..8560593 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -182,8 +182,9 @@
mLock.lock();
if (mState == TONE_STARTING) {
LOGV("Wait for start callback");
- if (mWaitCbkCond.waitRelative(mLock, seconds(1)) != NO_ERROR) {
- LOGE("--- Immediate start timed out");
+ status_t lStatus = mWaitCbkCond.waitRelative(mLock, seconds(1));
+ if (lStatus != NO_ERROR) {
+ LOGE("--- Immediate start timed out, status %d", lStatus);
mState = TONE_IDLE;
lResult = false;
}
@@ -195,13 +196,14 @@
LOGV("Delayed start\n");
mState = TONE_RESTARTING;
- if (mWaitCbkCond.waitRelative(mLock, seconds(1)) == NO_ERROR) {
+ status_t lStatus = mWaitCbkCond.waitRelative(mLock, seconds(1));
+ if (lStatus == NO_ERROR) {
if (mState != TONE_IDLE) {
lResult = true;
}
LOGV("cond received");
} else {
- LOGE("--- Delayed start timed out");
+ LOGE("--- Delayed start timed out, status %d", lStatus);
mState = TONE_IDLE;
}
}
@@ -368,6 +370,8 @@
break;
default:
LOGV("Extra Cbk");
+ // Force loop exit
+ lNumSmp = 0;
goto audioCallback_EndLoop;
}