summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice
diff options
context:
space:
mode:
authorRonghua Wu <ronghuawu@google.com>2014-10-03 15:19:10 -0700
committerRonghua Wu <ronghuawu@google.com>2014-10-03 16:48:27 -0700
commitd7988b1a7b32e39e671f7d4e2b2d8027a1f99639 (patch)
tree50d4eebca56d694337ad5074a669fc2500fd2693 /media/libmediaplayerservice
parentaf1a4dc989d6707116eaefab300ad55124aace66 (diff)
downloadframeworks_av-d7988b1a7b32e39e671f7d4e2b2d8027a1f99639.zip
frameworks_av-d7988b1a7b32e39e671f7d4e2b2d8027a1f99639.tar.gz
frameworks_av-d7988b1a7b32e39e671f7d4e2b2d8027a1f99639.tar.bz2
NuPlayer: add audioDecoderStillNeeded.
Bug: 17752358 Change-Id: Ia3b3ee4df65e5564afd0723943d2d747f3a604af
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.cpp11
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.h2
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);