diff options
author | Chong Zhang <chz@google.com> | 2015-04-17 15:49:06 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2015-04-17 15:53:17 -0700 |
commit | 3b032b3865fd93173aadca0591eeea32853206f9 (patch) | |
tree | fdc80def5b8a99b7360230497758a973e5eacbc2 /media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp | |
parent | 2170233c49e50f3986cdc4f726016d6003cb5b8e (diff) | |
download | frameworks_av-3b032b3865fd93173aadca0591eeea32853206f9.zip frameworks_av-3b032b3865fd93173aadca0591eeea32853206f9.tar.gz frameworks_av-3b032b3865fd93173aadca0591eeea32853206f9.tar.bz2 |
NuPlayer: queue a deferred scan sources when flushing during scan
also refactor code to move scheduleRequestBuffers to decoder base.
bug: 20267388
Change-Id: I48f16adc6b4d4008f8fcda8b3b01c595ad199f8b
Diffstat (limited to 'media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp index d521c64..65e80c3 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp @@ -82,14 +82,16 @@ void NuPlayer::Decoder::onMessageReceived(const sp<AMessage> &msg) { switch (msg->what()) { case kWhatCodecNotify: { + int32_t cbID; + CHECK(msg->findInt32("callbackID", &cbID)); + + ALOGV("[%s] kWhatCodecNotify: cbID = %d, paused = %d", + mIsAudio ? "audio" : "video", cbID, mPaused); + if (mPaused) { break; } - int32_t cbID; - CHECK(msg->findInt32("callbackID", &cbID)); - - ALOGV("kWhatCodecNotify: cbID = %d", cbID); switch (cbID) { case MediaCodec::CB_INPUT_AVAILABLE: { @@ -356,11 +358,14 @@ void NuPlayer::Decoder::onShutdown(bool notifyComplete) { } } -void NuPlayer::Decoder::doRequestBuffers() { +/* + * returns true if we should request more data + */ +bool NuPlayer::Decoder::doRequestBuffers() { // mRenderer is only NULL if we have a legacy widevine source that // is not yet ready. In this case we must not fetch input. if (isDiscontinuityPending() || mRenderer == NULL) { - return; + return false; } status_t err = OK; while (err == OK && !mDequeuedInputBuffers.empty()) { @@ -380,10 +385,8 @@ void NuPlayer::Decoder::doRequestBuffers() { } } - if (err == -EWOULDBLOCK - && mSource->feedMoreTSData() == OK) { - scheduleRequestBuffers(); - } + return err == -EWOULDBLOCK + && mSource->feedMoreTSData() == OK; } void NuPlayer::Decoder::handleError(int32_t err) @@ -846,9 +849,6 @@ void NuPlayer::Decoder::finishHandleDiscontinuity(bool flushOnTimeChange) { doFlush(false /* notifyComplete */); signalResume(false /* notifyComplete */); } - - // restart fetching input - scheduleRequestBuffers(); } // Notify NuPlayer to either shutdown decoder, or rescan sources |