diff options
author | Ronghua Wu <ronghuawu@google.com> | 2014-12-02 01:24:34 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-02 01:24:34 +0000 |
commit | a0f1d394aefb2e7c60ba90ea02a3e6c552c96a7c (patch) | |
tree | dfb3ca3868fef787343a166861d3b2521655360b /media/libmediaplayerservice | |
parent | 126f3d00be30e6ebdbfc8b877650d21ad2392bf7 (diff) | |
parent | 48662b3a0e88c85dc1ff401427892c695f1937b5 (diff) | |
download | frameworks_av-a0f1d394aefb2e7c60ba90ea02a3e6c552c96a7c.zip frameworks_av-a0f1d394aefb2e7c60ba90ea02a3e6c552c96a7c.tar.gz frameworks_av-a0f1d394aefb2e7c60ba90ea02a3e6c552c96a7c.tar.bz2 |
am 48662b3a: am 779d4164: am f1828910: nuplayer: clear pending audio access unit on flush.
* commit '48662b3a0e88c85dc1ff401427892c695f1937b5':
nuplayer: clear pending audio access unit on flush.
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp | 17 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.h | 3 |
2 files changed, 14 insertions, 6 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp index 8112e9f..79b7a3c 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp @@ -47,6 +47,7 @@ NuPlayer::DecoderPassThrough::DecoderPassThrough( mSource(source), mRenderer(renderer), mSkipRenderingUntilMediaTimeUs(-1ll), + mPaused(false), mBufferGeneration(0), mReachedEOS(true), mPendingAudioErr(OK), @@ -105,16 +106,16 @@ bool NuPlayer::DecoderPassThrough::isStaleReply(const sp<AMessage> &msg) { return generation != mBufferGeneration; } -bool NuPlayer::DecoderPassThrough::isCacheFullOrEOS() const { - ALOGV("[%s] mCachedBytes = %zu, mReachedEOS = %d", - mComponentName.c_str(), mCachedBytes, mReachedEOS); +bool NuPlayer::DecoderPassThrough::isDoneFetching() const { + ALOGV("[%s] mCachedBytes = %zu, mReachedEOS = %d mPaused = %d", + mComponentName.c_str(), mCachedBytes, mReachedEOS, mPaused); - return mCachedBytes >= kMaxCachedBytes || mReachedEOS; + return mCachedBytes >= kMaxCachedBytes || mReachedEOS || mPaused; } void NuPlayer::DecoderPassThrough::doRequestBuffers() { status_t err = OK; - while (!isCacheFullOrEOS()) { + while (!isDoneFetching()) { sp<AMessage> msg = new AMessage(); err = fetchInputData(msg); @@ -355,6 +356,8 @@ void NuPlayer::DecoderPassThrough::onBufferConsumed(int32_t size) { } void NuPlayer::DecoderPassThrough::onResume(bool notifyComplete) { + mPaused = false; + onRequestInputBuffers(); if (notifyComplete) { @@ -367,6 +370,9 @@ void NuPlayer::DecoderPassThrough::onResume(bool notifyComplete) { void NuPlayer::DecoderPassThrough::onFlush(bool notifyComplete) { ++mBufferGeneration; mSkipRenderingUntilMediaTimeUs = -1; + mPendingAudioAccessUnit.clear(); + mPendingAudioErr = OK; + mAggregateBuffer.clear(); if (mRenderer != NULL) { mRenderer->flush(true /* audio */, notifyComplete); @@ -374,6 +380,7 @@ void NuPlayer::DecoderPassThrough::onFlush(bool notifyComplete) { } if (notifyComplete) { + mPaused = true; sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", kWhatFlushCompleted); notify->post(); diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.h b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.h index d761b07..37b28c8 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.h +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.h @@ -56,6 +56,7 @@ private: sp<Source> mSource; sp<Renderer> mRenderer; int64_t mSkipRenderingUntilMediaTimeUs; + bool mPaused; int32_t mBufferGeneration; bool mReachedEOS; @@ -73,7 +74,7 @@ private: AString mComponentName; bool isStaleReply(const sp<AMessage> &msg); - bool isCacheFullOrEOS() const; + bool isDoneFetching() const; status_t dequeueAccessUnit(sp<ABuffer> *accessUnit); sp<ABuffer> aggregateBuffer(const sp<ABuffer> &accessUnit); |