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

Commit 2cb834fd authored by Vidyakumar Athota's avatar Vidyakumar Athota Committed by Steve Kondik
Browse files

frameworks/av: Syncronize resume and onPauseTimeOut

- All the mixer controls are closed 3s after pausing playback
through the onPauseTimeOut function
- A scenario where onPauseTimeOut is closing mixer controls, a
resume is issued, causes a crash
- Synchronize these 2 functions using a mutex to prevent
concurrent execution.

Change-Id: I850452f4d38d05cfa92ca4690a665b8e64170a49
CRs-Fixed: 398948
parent 69a4fb17
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -210,6 +210,7 @@ private:
    MediaBuffer *mInputBuffer;

    Mutex mLock;
    Mutex mResumeLock;

    bool mSeeking;
    bool mReachedEOS;
+2 −0
Original line number Diff line number Diff line
@@ -356,6 +356,7 @@ void LPAPlayer::pause(bool playPendingSamples) {

void LPAPlayer::resume() {
    ALOGV("resume: mPaused %d",mPaused);
    Mutex::Autolock autoLock(mResumeLock);
    if ( mPaused) {
        CHECK(mStarted);
        if (!mIsA2DPEnabled) {
@@ -758,6 +759,7 @@ void LPAPlayer::requestAndWaitForA2DPNotificationThreadExit() {

void LPAPlayer::onPauseTimeOut() {
    ALOGV("onPauseTimeOut");
    Mutex::Autolock autoLock(mResumeLock);
    if (!mPauseEventPending) {
        return;
    }