Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc09e042 authored by Eric Laurent's avatar Eric Laurent Committed by Android Git Automerger
Browse files

am dd28d563: Fix 2209967 Tonegenerator: mutex not release in startTone() upon...

am dd28d563: Fix 2209967 Tonegenerator: mutex not release in startTone() upon timeout waiting for the stop sequence to complete.

Merge commit 'dd28d56368441537ec5eb42150516416fdbf10ad' into eclair-plus-aosp

* commit 'dd28d56368441537ec5eb42150516416fdbf10ad':
  Fix 2209967 Tonegenerator: mutex not release in startTone() upon timeout waiting for the stop sequence to complete.
parents 9de9709d a9a43909
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -903,10 +903,11 @@ bool ToneGenerator::startTone(int toneType, int durationMs) {

    if (mState == TONE_STOPPED) {
        LOGV("Start waiting for previous tone to stop");
        lStatus = mWaitCbkCond.waitRelative(mLock, seconds(1));
        lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
        if (lStatus != NO_ERROR) {
            LOGE("--- start wait for stop timed out, status %d", lStatus);
            mState = TONE_IDLE;
            mLock.unlock();
            return lResult;
        }
    }
@@ -921,7 +922,7 @@ bool ToneGenerator::startTone(int toneType, int durationMs) {
            mLock.lock();
            if (mState == TONE_STARTING) {
                LOGV("Wait for start callback");
                lStatus = mWaitCbkCond.waitRelative(mLock, seconds(1));
                lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
                if (lStatus != NO_ERROR) {
                    LOGE("--- Immediate start timed out, status %d", lStatus);
                    mState = TONE_IDLE;
@@ -934,7 +935,7 @@ bool ToneGenerator::startTone(int toneType, int durationMs) {
    } else {
        LOGV("Delayed start\n");
        mState = TONE_RESTARTING;
        lStatus = mWaitCbkCond.waitRelative(mLock, seconds(1));
        lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
        if (lStatus == NO_ERROR) {
            if (mState != TONE_IDLE) {
                lResult = true;
@@ -973,7 +974,7 @@ void ToneGenerator::stopTone() {
    if (mState == TONE_PLAYING || mState == TONE_STARTING || mState == TONE_RESTARTING) {
        mState = TONE_STOPPING;
        LOGV("waiting cond");
        status_t lStatus = mWaitCbkCond.waitRelative(mLock, seconds(1));
        status_t lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3));
        if (lStatus == NO_ERROR) {
            LOGV("track stop complete, time %d", (unsigned int)(systemTime()/1000000));
        } else {
@@ -1087,6 +1088,7 @@ void ToneGenerator::audioCallback(int event, void* user, void *info) {

        lpToneGen->mLock.lock();


        // Update pcm frame count and end time (current time at the end of this process)
        lpToneGen->mTotalSmp += lReqSmp;