summaryrefslogtreecommitdiffstats
path: root/media/libmedia/mediaplayer.cpp
diff options
context:
space:
mode:
authorNicolas Catania <niko@google.com>2010-03-10 10:41:04 -0800
committerNicolas Catania <niko@google.com>2010-03-11 10:07:14 -0800
commit4023493a827bc9751d8e40795516d0d536a53348 (patch)
tree468f39da8a380f6d7c01ea3a6fa0d5c91ffa47c4 /media/libmedia/mediaplayer.cpp
parent6fc13ab8d00819b7420d1b0a500896264e820409 (diff)
downloadframeworks_av-4023493a827bc9751d8e40795516d0d536a53348.zip
frameworks_av-4023493a827bc9751d8e40795516d0d536a53348.tar.gz
frameworks_av-4023493a827bc9751d8e40795516d0d536a53348.tar.bz2
Allow invoke in all the player states except idle and error.
Previously invoke would work only after prepare but not when the player is in play or pause state (for instance). This new change just check that the player has been initialized and is not in the error state. Bug:2488931 Change-Id: I9b9f3679593a3b7697c1a84d993fdcd7e1693a90
Diffstat (limited to 'media/libmedia/mediaplayer.cpp')
-rw-r--r--media/libmedia/mediaplayer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp
index f623295..c6bbbcc 100644
--- a/media/libmedia/mediaplayer.cpp
+++ b/media/libmedia/mediaplayer.cpp
@@ -159,8 +159,10 @@ status_t MediaPlayer::setDataSource(int fd, int64_t offset, int64_t length)
status_t MediaPlayer::invoke(const Parcel& request, Parcel *reply)
{
Mutex::Autolock _l(mLock);
- if ((mPlayer != NULL) && ( mCurrentState & MEDIA_PLAYER_INITIALIZED ))
- {
+ const bool hasBeenInitialized =
+ (mCurrentState != MEDIA_PLAYER_STATE_ERROR) &&
+ ((mCurrentState & MEDIA_PLAYER_IDLE) != MEDIA_PLAYER_IDLE);
+ if ((mPlayer != NULL) && hasBeenInitialized) {
LOGV("invoke %d", request.dataSize());
return mPlayer->invoke(request, reply);
}