diff options
author | Haynes Mathew George <hgeorge@codeaurora.org> | 2015-12-01 12:28:29 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-19 02:46:24 -0500 |
commit | ce4e90394c5c4ccf79678fa3c4b32ffd63cd3bf1 (patch) | |
tree | 6440a155d8e03238dae4ead1622ccaf6a20485f9 /media/libmediaplayerservice | |
parent | 05f67ffe45268807d2782a9d1c0cf212956fa925 (diff) | |
download | frameworks_av-ce4e90394c5c4ccf79678fa3c4b32ffd63cd3bf1.zip frameworks_av-ce4e90394c5c4ccf79678fa3c4b32ffd63cd3bf1.tar.gz frameworks_av-ce4e90394c5c4ccf79678fa3c4b32ffd63cd3bf1.tar.bz2 |
Revert "nuplayer: Perform proper shutdown sequence for offload teardown"
This reverts commit 9944bae1fda19634b04cd4e2b755c3d368405a8b.
CRs-Fixed: 941002
Change-Id: Ief7c6a1a8d9fd290da49867b1fef9f6e9e2a51a1
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 51 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.h | 2 |
2 files changed, 43 insertions, 10 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index e7ff037..1d3ea45 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -1118,7 +1118,46 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { int32_t reason; CHECK(msg->findInt32("reason", &reason)); ALOGV("Tear down audio with reason %d.", reason); - performTearDown(msg); + + if (ifDecodedPCMOffload()) { + tearDownPCMOffload(msg); + break; + } + + mAudioDecoder.clear(); + ++mAudioDecoderGeneration; + bool needsToCreateAudioDecoder = true; + if (mFlushingAudio == FLUSHING_DECODER) { + mFlushComplete[1 /* audio */][1 /* isDecoder */] = true; + mFlushingAudio = FLUSHED; + finishFlushIfPossible(); + } else if (mFlushingAudio == FLUSHING_DECODER_SHUTDOWN + || mFlushingAudio == SHUTTING_DOWN_DECODER) { + mFlushComplete[1 /* audio */][1 /* isDecoder */] = true; + mFlushingAudio = SHUT_DOWN; + finishFlushIfPossible(); + needsToCreateAudioDecoder = false; + } + if (mRenderer == NULL) { + break; + } + closeAudioSink(); + mRenderer->flush( + true /* audio */, false /* notifyComplete */); + if (mVideoDecoder != NULL) { + mRenderer->flush( + false /* audio */, false /* notifyComplete */); + } + + int64_t positionUs; + if (!msg->findInt64("positionUs", &positionUs)) { + positionUs = mPreviousSeekTimeUs; + } + performSeek(positionUs); + + if (reason == Renderer::kDueToError && needsToCreateAudioDecoder) { + instantiateDecoder(true /* audio */, &mAudioDecoder); + } } break; } @@ -2409,12 +2448,7 @@ void NuPlayer::Source::onMessageReceived(const sp<AMessage> & /* msg */) { TRESPASS(); } -// -// There is a flush from within the decoder's onFlush handling. -// Without it, it is still possible that a buffer can be queueued -// after NuPlayer issues a flush on the renderer's audio queue. -// -void NuPlayer::performTearDown(const sp<AMessage> &msg) { +void NuPlayer::tearDownPCMOffload(const sp<AMessage> &msg) { int32_t reason; CHECK(msg->findInt32("reason", &reason)); @@ -2438,14 +2472,13 @@ void NuPlayer::performTearDown(const sp<AMessage> &msg) { mDeferredActions.push_back(new SeekAction(positionUs)); break; default: - ALOGW("performTearDown while flushing audio in %d", mFlushingAudio); + ALOGW("tearDownPCMOffload while flushing audio in %d", mFlushingAudio); break; } } if (mRenderer != NULL) { closeAudioSink(); - // see comment at beginning of function mRenderer->flush( true /* audio */, false /* notifyComplete */); if (mVideoDecoder != NULL) { diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.h b/media/libmediaplayerservice/nuplayer/NuPlayer.h index c093b0f..4ee3ffc 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.h +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.h @@ -283,7 +283,7 @@ protected: void writeTrackInfo(Parcel* reply, const sp<AMessage> format) const; - void performTearDown(const sp<AMessage> &msg); + void tearDownPCMOffload(const sp<AMessage> &msg); DISALLOW_EVIL_CONSTRUCTORS(NuPlayer); }; |