diff options
author | Steve Kondik <steve@cyngn.com> | 2015-11-29 21:21:15 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-11-29 21:21:15 -0800 |
commit | c85eb5757f55a1a0bb4737971335d410733c5d05 (patch) | |
tree | 2195fbe1e389e66fc745c7735eec75c2cbc3b188 /media/libmediaplayerservice/nuplayer/NuPlayer.cpp | |
parent | 3f54b2b7dcdfec8870565588b5e63e93dc5b363d (diff) | |
parent | 7936537049c7f389cddc5ad4d815a5119b589853 (diff) | |
download | frameworks_av-c85eb5757f55a1a0bb4737971335d410733c5d05.zip frameworks_av-c85eb5757f55a1a0bb4737971335d410733c5d05.tar.gz frameworks_av-c85eb5757f55a1a0bb4737971335d410733c5d05.tar.bz2 |
Merge branch 'LA.BF64.1.2.2_rb4.8' of git://codeaurora.org/platform/frameworks/av into cm-13.0
Diffstat (limited to 'media/libmediaplayerservice/nuplayer/NuPlayer.cpp')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index 8064781..a494e87 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -1111,46 +1111,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { int32_t reason; CHECK(msg->findInt32("reason", &reason)); ALOGV("Tear down audio with reason %d.", reason); - - 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); - } + performTearDown(msg); } break; } @@ -2419,7 +2380,12 @@ void NuPlayer::Source::onMessageReceived(const sp<AMessage> & /* msg */) { TRESPASS(); } -void NuPlayer::tearDownPCMOffload(const sp<AMessage> &msg) { +// +// 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) { int32_t reason; CHECK(msg->findInt32("reason", &reason)); @@ -2443,13 +2409,14 @@ void NuPlayer::tearDownPCMOffload(const sp<AMessage> &msg) { mDeferredActions.push_back(new SeekAction(positionUs)); break; default: - ALOGW("tearDownPCMOffload while flushing audio in %d", mFlushingAudio); + ALOGW("performTearDown 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) { |