am dd28d563: Fix 2209967 Tonegenerator: mutex not release in startTone() upon timeout waiting for the stop sequence to complete.
Merge commit 'dd28d56368441537ec5eb42150516416fdbf10ad' into eclair-mr2 * commit 'dd28d56368441537ec5eb42150516416fdbf10ad': Fix 2209967 Tonegenerator: mutex not release in startTone() upon timeout waiting for the stop sequence to complete.
This commit is contained in:
@@ -903,10 +903,11 @@ bool ToneGenerator::startTone(int toneType, int durationMs) {
|
|||||||
|
|
||||||
if (mState == TONE_STOPPED) {
|
if (mState == TONE_STOPPED) {
|
||||||
LOGV("Start waiting for previous tone to stop");
|
LOGV("Start waiting for previous tone to stop");
|
||||||
lStatus = mWaitCbkCond.waitRelative(mLock, seconds(1));
|
lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
|
||||||
if (lStatus != NO_ERROR) {
|
if (lStatus != NO_ERROR) {
|
||||||
LOGE("--- start wait for stop timed out, status %d", lStatus);
|
LOGE("--- start wait for stop timed out, status %d", lStatus);
|
||||||
mState = TONE_IDLE;
|
mState = TONE_IDLE;
|
||||||
|
mLock.unlock();
|
||||||
return lResult;
|
return lResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -921,7 +922,7 @@ bool ToneGenerator::startTone(int toneType, int durationMs) {
|
|||||||
mLock.lock();
|
mLock.lock();
|
||||||
if (mState == TONE_STARTING) {
|
if (mState == TONE_STARTING) {
|
||||||
LOGV("Wait for start callback");
|
LOGV("Wait for start callback");
|
||||||
lStatus = mWaitCbkCond.waitRelative(mLock, seconds(1));
|
lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
|
||||||
if (lStatus != NO_ERROR) {
|
if (lStatus != NO_ERROR) {
|
||||||
LOGE("--- Immediate start timed out, status %d", lStatus);
|
LOGE("--- Immediate start timed out, status %d", lStatus);
|
||||||
mState = TONE_IDLE;
|
mState = TONE_IDLE;
|
||||||
@@ -934,7 +935,7 @@ bool ToneGenerator::startTone(int toneType, int durationMs) {
|
|||||||
} else {
|
} else {
|
||||||
LOGV("Delayed start\n");
|
LOGV("Delayed start\n");
|
||||||
mState = TONE_RESTARTING;
|
mState = TONE_RESTARTING;
|
||||||
lStatus = mWaitCbkCond.waitRelative(mLock, seconds(1));
|
lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
|
||||||
if (lStatus == NO_ERROR) {
|
if (lStatus == NO_ERROR) {
|
||||||
if (mState != TONE_IDLE) {
|
if (mState != TONE_IDLE) {
|
||||||
lResult = true;
|
lResult = true;
|
||||||
@@ -973,7 +974,7 @@ void ToneGenerator::stopTone() {
|
|||||||
if (mState == TONE_PLAYING || mState == TONE_STARTING || mState == TONE_RESTARTING) {
|
if (mState == TONE_PLAYING || mState == TONE_STARTING || mState == TONE_RESTARTING) {
|
||||||
mState = TONE_STOPPING;
|
mState = TONE_STOPPING;
|
||||||
LOGV("waiting cond");
|
LOGV("waiting cond");
|
||||||
status_t lStatus = mWaitCbkCond.waitRelative(mLock, seconds(1));
|
status_t lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
|
||||||
if (lStatus == NO_ERROR) {
|
if (lStatus == NO_ERROR) {
|
||||||
LOGV("track stop complete, time %d", (unsigned int)(systemTime()/1000000));
|
LOGV("track stop complete, time %d", (unsigned int)(systemTime()/1000000));
|
||||||
} else {
|
} else {
|
||||||
@@ -1087,6 +1088,7 @@ void ToneGenerator::audioCallback(int event, void* user, void *info) {
|
|||||||
|
|
||||||
lpToneGen->mLock.lock();
|
lpToneGen->mLock.lock();
|
||||||
|
|
||||||
|
|
||||||
// Update pcm frame count and end time (current time at the end of this process)
|
// Update pcm frame count and end time (current time at the end of this process)
|
||||||
lpToneGen->mTotalSmp += lReqSmp;
|
lpToneGen->mTotalSmp += lReqSmp;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user