diff options
author | Ronghua Wu <ronghuawu@google.com> | 2014-10-06 15:38:17 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-10-06 15:38:18 +0000 |
commit | c4da004d4baef8cc4a631058549216c8d2383824 (patch) | |
tree | c017872f79ff2ba038feff3c2337222db8b9be1f /media | |
parent | f0011d49c0f08753dc2dc254c5a70885a9986602 (diff) | |
parent | d7988b1a7b32e39e671f7d4e2b2d8027a1f99639 (diff) | |
download | frameworks_av-c4da004d4baef8cc4a631058549216c8d2383824.zip frameworks_av-c4da004d4baef8cc4a631058549216c8d2383824.tar.gz frameworks_av-c4da004d4baef8cc4a631058549216c8d2383824.tar.bz2 |
Merge "NuPlayer: add audioDecoderStillNeeded." into lmp-dev
Diffstat (limited to 'media')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 11 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.h | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index 5270efc..53eec91 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -1048,9 +1048,9 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { } else { ALOGW("resume called when source is gone or not set"); } - // |mAudioDecoder| may have been released due to the pause timeout, so try to re-create - // it if needed. - if (mFlushingAudio != SHUT_DOWN) { + // |mAudioDecoder| may have been released due to the pause timeout, so re-create it if + // needed. + if (audioDecoderStillNeeded() && mAudioDecoder == NULL) { instantiateDecoder(true /* audio */, &mAudioDecoder); } if (mRenderer != NULL) { @@ -1079,6 +1079,11 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { } } +bool NuPlayer::audioDecoderStillNeeded() { + // Audio decoder is no longer needed if it's in shut/shutting down status. + return ((mFlushingAudio != SHUT_DOWN) && (mFlushingAudio != SHUTTING_DOWN_DECODER)); +} + void NuPlayer::finishFlushIfPossible() { if (mFlushingAudio != NONE && mFlushingAudio != FLUSHED && mFlushingAudio != SHUT_DOWN) { diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.h b/media/libmediaplayerservice/nuplayer/NuPlayer.h index 8fa7269..8157733 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.h +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.h @@ -203,6 +203,8 @@ private: void finishFlushIfPossible(); + bool audioDecoderStillNeeded(); + void flushDecoder( bool audio, bool needShutdown, const sp<AMessage> &newFormat = NULL); void updateDecoderFormatWithoutFlush(bool audio, const sp<AMessage> &format); |