diff options
author | Marco Nelissen <marcone@google.com> | 2013-08-05 12:22:43 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2013-08-05 12:22:43 -0700 |
commit | b13820ffafcb6bcdd33b6272676535afb4dff479 (patch) | |
tree | 92e42e1eee0dc499bfdf65b63db4b1b1aaf04da8 /media | |
parent | f36dbfe3d517e9311be0a4d0fd6658380690e84c (diff) | |
download | frameworks_av-b13820ffafcb6bcdd33b6272676535afb4dff479.zip frameworks_av-b13820ffafcb6bcdd33b6272676535afb4dff479.tar.gz frameworks_av-b13820ffafcb6bcdd33b6272676535afb4dff479.tar.bz2 |
Reject unprepared MediaPlayers
Don't allow a MediaPlayer that has been reset() or release()d to be
used as the argument to setNextMediaPlayer.
Change-Id: I47da1460ec3742f5b2bd7b79e7998b290032d5a1
Diffstat (limited to 'media')
-rw-r--r-- | media/libmedia/mediaplayer.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp index 963b04f..056cc0a 100644 --- a/media/libmedia/mediaplayer.cpp +++ b/media/libmedia/mediaplayer.cpp @@ -811,6 +811,13 @@ status_t MediaPlayer::setNextMediaPlayer(const sp<MediaPlayer>& next) { if (mPlayer == NULL) { return NO_INIT; } + + if (next != NULL && !(next->mCurrentState & + (MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_PLAYBACK_COMPLETE))) { + ALOGE("next player is not prepared"); + return INVALID_OPERATION; + } + return mPlayer->setNextPlayer(next == NULL ? NULL : next->mPlayer); } |