diff options
author | Y Mehta <ymehta@codeaurora.org> | 2010-10-29 14:00:30 +0530 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2011-10-30 04:49:20 +0100 |
commit | c238fa35e00a0321b8988260bb4ed76b72466c81 (patch) | |
tree | 87defa470ab4accfff0d6fd6bcbeba287e1da3c3 /media | |
parent | 663ba31cd21c545d2b5c5b15c5351037e01cad5e (diff) | |
download | frameworks_base-c238fa35e00a0321b8988260bb4ed76b72466c81.zip frameworks_base-c238fa35e00a0321b8988260bb4ed76b72466c81.tar.gz frameworks_base-c238fa35e00a0321b8988260bb4ed76b72466c81.tar.bz2 |
frameworks/base: Fix for force close during rapid FF of cetain midi clips
-Rapid fast forward of certain midi clips result in force close
message and music app exits.
-setDataSource and prepare fail in playback complete state of
media player
-Return error when setDataSource and prepare are called in playback
complete state.
Change-Id: Ie7cf80a36400db833b6e6d7c162f8a8f8eee2e5e
CRs-Fixed: 260087
Diffstat (limited to 'media')
-rw-r--r-- | media/libmedia/mediaplayer.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp index 0bf35ce..ba21524 100644 --- a/media/libmedia/mediaplayer.cpp +++ b/media/libmedia/mediaplayer.cpp @@ -106,6 +106,9 @@ status_t MediaPlayer::setDataSource(const sp<IMediaPlayer>& player) { // scope for the lock Mutex::Autolock _l(mLock); + if (mCurrentState & MEDIA_PLAYER_PLAYBACK_COMPLETE) + return UNKNOWN_ERROR; + if ( !( (mCurrentState & MEDIA_PLAYER_IDLE) || (mCurrentState == MEDIA_PLAYER_STATE_ERROR ) ) ) { LOGE("setDataSource called in state %d", mCurrentState); @@ -216,6 +219,9 @@ status_t MediaPlayer::setVideoSurface(const sp<Surface>& surface) // must call with lock held status_t MediaPlayer::prepareAsync_l() { + if (mCurrentState & MEDIA_PLAYER_PLAYBACK_COMPLETE) + return UNKNOWN_ERROR; + if ( (mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_INITIALIZED | MEDIA_PLAYER_STOPPED) ) ) { mPlayer->setAudioStreamType(mStreamType); mCurrentState = MEDIA_PLAYER_PREPARING; |