summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2014-08-26 13:57:32 -0700
committerThe Android Automerger <android-build@google.com>2014-08-26 17:15:41 -0700
commit1c874b152291361fb5a05fc9da87aba664898fd5 (patch)
tree79de55422fc962458cbf6f50917e5596687dfc8c
parent9a8b629ad56f97e0178aa7352bafd66ec6b0ced3 (diff)
downloadframeworks_av-1c874b152291361fb5a05fc9da87aba664898fd5.zip
frameworks_av-1c874b152291361fb5a05fc9da87aba664898fd5.tar.gz
frameworks_av-1c874b152291361fb5a05fc9da87aba664898fd5.tar.bz2
Fix SoundPool lockup
NuPlayerDriver needs to update its internal state before calling its listener, so that when the listener calls back into NuPlayerDriver, NuPlayerDriver has the right state. Bug: 14057920 Change-Id: I224882c427f5e3c9d4bf96c5d68075e235062401
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
index 2f60072..c4bbcdf 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
@@ -287,8 +287,9 @@ status_t NuPlayerDriver::stop() {
// fall through
case STATE_PAUSED:
+ mState = STATE_STOPPED;
notifyListener_l(MEDIA_STOPPED);
- // fall through
+ break;
case STATE_PREPARED:
case STATE_STOPPED:
@@ -314,6 +315,8 @@ status_t NuPlayerDriver::pause() {
return OK;
case STATE_RUNNING:
+ setPauseStartedTimeIfNeeded();
+ mState = STATE_PAUSED;
notifyListener_l(MEDIA_PAUSED);
mPlayer->pause();
break;
@@ -322,9 +325,6 @@ status_t NuPlayerDriver::pause() {
return INVALID_OPERATION;
}
- setPauseStartedTimeIfNeeded();
- mState = STATE_PAUSED;
-
return OK;
}
@@ -675,15 +675,17 @@ void NuPlayerDriver::notifyPrepareCompleted(status_t err) {
mAsyncResult = err;
if (err == OK) {
+ // update state before notifying client, so that if client calls back into NuPlayerDriver
+ // in response, NuPlayerDriver has the right state
+ mState = STATE_PREPARED;
if (mIsAsyncPrepare) {
notifyListener_l(MEDIA_PREPARED);
}
- mState = STATE_PREPARED;
} else {
+ mState = STATE_UNPREPARED;
if (mIsAsyncPrepare) {
notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err);
}
- mState = STATE_UNPREPARED;
}
mCondition.broadcast();