diff options
author | Andreas Huber <andih@google.com> | 2011-10-28 16:17:54 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-10-28 16:17:54 +0000 |
commit | e10d9126e5b54d5310c7b7f87d46de5b680faf1e (patch) | |
tree | ab49bbf0f55ff0e8465c282875b5d713b134b1bd /media | |
parent | e4cce21040de01f4316cdaa00bbbb49196ea8a13 (diff) | |
parent | 27ed12492dfbec6ec67b66ff3cf60febce370b01 (diff) | |
download | frameworks_base-e10d9126e5b54d5310c7b7f87d46de5b680faf1e.zip frameworks_base-e10d9126e5b54d5310c7b7f87d46de5b680faf1e.tar.gz frameworks_base-e10d9126e5b54d5310c7b7f87d46de5b680faf1e.tar.bz2 |
am 27ed1249: Merge "Properly report that we\'re no longer playing after receiving event" into ics-mr1
* commit '27ed12492dfbec6ec67b66ff3cf60febce370b01':
Properly report that we're no longer playing after receiving event
Diffstat (limited to 'media')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 2 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp | 17 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDriver.h | 2 |
3 files changed, 17 insertions, 4 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index 4b2bdcc..6d44501 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -796,7 +796,7 @@ void NuPlayer::notifyListener(int msg, int ext1, int ext2) { return; } - driver->sendEvent(msg, ext1, ext2); + driver->notifyListener(msg, ext1, ext2); } void NuPlayer::flushDecoder(bool audio, bool needShutdown) { diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp index b1e917d..452ba99 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp @@ -35,6 +35,7 @@ NuPlayerDriver::NuPlayerDriver() mNumFramesDropped(0), mLooper(new ALooper), mState(UNINITIALIZED), + mAtEOS(false), mStartupSeekTimeUs(-1) { mLooper->setName("NuPlayerDriver Looper"); @@ -106,7 +107,7 @@ status_t NuPlayerDriver::prepare() { } status_t NuPlayerDriver::prepareAsync() { - sendEvent(MEDIA_PREPARED); + notifyListener(MEDIA_PREPARED); return OK; } @@ -117,6 +118,7 @@ status_t NuPlayerDriver::start() { return INVALID_OPERATION; case STOPPED: { + mAtEOS = false; mPlayer->start(); if (mStartupSeekTimeUs >= 0) { @@ -173,7 +175,7 @@ status_t NuPlayerDriver::pause() { } bool NuPlayerDriver::isPlaying() { - return mState == PLAYING; + return mState == PLAYING && !mAtEOS; } status_t NuPlayerDriver::seekTo(int msec) { @@ -190,6 +192,7 @@ status_t NuPlayerDriver::seekTo(int msec) { case PLAYING: case PAUSED: { + mAtEOS = false; mPlayer->seekToAsync(seekTimeUs); break; } @@ -291,7 +294,7 @@ void NuPlayerDriver::notifyPosition(int64_t positionUs) { } void NuPlayerDriver::notifySeekComplete() { - sendEvent(MEDIA_SEEK_COMPLETE); + notifyListener(MEDIA_SEEK_COMPLETE); } void NuPlayerDriver::notifyFrameStats( @@ -320,4 +323,12 @@ status_t NuPlayerDriver::dump(int fd, const Vector<String16> &args) const { return OK; } +void NuPlayerDriver::notifyListener(int msg, int ext1, int ext2) { + if (msg == MEDIA_PLAYBACK_COMPLETE || msg == MEDIA_ERROR) { + mAtEOS = true; + } + + sendEvent(msg, ext1, ext2); +} + } // namespace android diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h index 181c37d..aaa3de0 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h @@ -67,6 +67,7 @@ struct NuPlayerDriver : public MediaPlayerInterface { void notifyPosition(int64_t positionUs); void notifySeekComplete(); void notifyFrameStats(int64_t numFramesTotal, int64_t numFramesDropped); + void notifyListener(int msg, int ext1 = 0, int ext2 = 0); protected: virtual ~NuPlayerDriver(); @@ -95,6 +96,7 @@ private: }; State mState; + bool mAtEOS; int64_t mStartupSeekTimeUs; |