diff options
author | Andreas Huber <andih@google.com> | 2011-11-28 16:27:35 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-11-28 16:27:35 -0800 |
commit | 551aeac336b426ae962e232d5223e7b994aaf1e1 (patch) | |
tree | 531855a6ed7be8612dfbf95dcca71d6088434acf /media | |
parent | e35581ad5ad635f9dcfe4ab6a432c48b46b782cd (diff) | |
download | frameworks_base-551aeac336b426ae962e232d5223e7b994aaf1e1.zip frameworks_base-551aeac336b426ae962e232d5223e7b994aaf1e1.tar.gz frameworks_base-551aeac336b426ae962e232d5223e7b994aaf1e1.tar.bz2 |
Make sure we can properly shutdown even if
a) one of the two decoders has a pending discontinuity
b) the renderer holds on to all output buffers for that decoder
c) the renderer is paused
if all three conditions are met the decoder won't ask for more input data
and therefore never see the discontinuity.
To avoid this we briefly resume the renderer just before shutting down.
Change-Id: I9e08af2a1eb4298d1cd00497d6aa33f4ad184e9a
related-to-bug: 5655016
Diffstat (limited to 'media')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 15 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp | 7 |
2 files changed, 20 insertions, 2 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index 2a5c0a6..effa5f5 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -462,11 +462,24 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { { LOGV("kWhatReset"); + if (mRenderer != NULL) { + // There's an edge case where the renderer owns all output + // buffers and is paused, therefore the decoder will not read + // more input data and will never encounter the matching + // discontinuity. To avoid this, we resume the renderer. + + if (mFlushingAudio == AWAITING_DISCONTINUITY + || mFlushingVideo == AWAITING_DISCONTINUITY) { + mRenderer->resume(); + } + } + if (mFlushingAudio != NONE || mFlushingVideo != NONE) { // We're currently flushing, postpone the reset until that's // completed. - LOGV("postponing reset"); + LOGV("postponing reset mFlushingAudio=%d, mFlushingVideo=%d", + mFlushingAudio, mFlushingVideo); mResetPostponed = true; break; diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp index 640e9fa..0cb7f45 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp @@ -628,11 +628,16 @@ void NuPlayer::Renderer::onPause() { mAudioSink->pause(); } + LOGV("now paused audio queue has %d entries, video has %d entries", + mAudioQueue.size(), mVideoQueue.size()); + mPaused = true; } void NuPlayer::Renderer::onResume() { - CHECK(mPaused); + if (!mPaused) { + return; + } if (mHasAudio) { mAudioSink->start(); |