diff options
author | Lajos Molnar <lajos@google.com> | 2015-02-10 04:33:08 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-02-10 04:33:08 +0000 |
commit | 157defdde7013062bbd04f7e873b6856adce14ca (patch) | |
tree | bf6503e41529df950c27f694e256519add85752b /media/libmediaplayerservice | |
parent | 6d5a1afac2a7bca6b171261ca9b237c3a516e567 (diff) | |
parent | 4fc5d758d6722bedf341e5d93a0ba5698c658c29 (diff) | |
download | frameworks_av-157defdde7013062bbd04f7e873b6856adce14ca.zip frameworks_av-157defdde7013062bbd04f7e873b6856adce14ca.tar.gz frameworks_av-157defdde7013062bbd04f7e873b6856adce14ca.tar.bz2 |
am 4fc5d758: am 0c11f31b: Merge "nuplayer: acquire wakelock during offload pause timeout" into lmp-mr1-dev
* commit '4fc5d758d6722bedf341e5d93a0ba5698c658c29':
nuplayer: acquire wakelock during offload pause timeout
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp | 8 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp index 04e52b8..25225a8 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp @@ -24,6 +24,7 @@ #include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/foundation/AMessage.h> #include <media/stagefright/foundation/AUtils.h> +#include <media/stagefright/foundation/AWakeLock.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MetaData.h> #include <media/stagefright/Utils.h> @@ -87,7 +88,9 @@ NuPlayer::Renderer::Renderer( mCurrentOffloadInfo(AUDIO_INFO_INITIALIZER), mCurrentPcmInfo(AUDIO_PCMINFO_INITIALIZER), mTotalBuffersQueued(0), - mLastAudioBufferDrained(0) { + mLastAudioBufferDrained(0), + mWakeLock(new AWakeLock()) { + } NuPlayer::Renderer::~Renderer() { @@ -514,6 +517,7 @@ void NuPlayer::Renderer::onMessageReceived(const sp<AMessage> &msg) { } ALOGV("Audio Offload tear down due to pause timeout."); onAudioOffloadTearDown(kDueToTimeout); + mWakeLock->release(); break; } @@ -1385,6 +1389,7 @@ void NuPlayer::Renderer::onAudioOffloadTearDown(AudioOffloadTearDownReason reaso void NuPlayer::Renderer::startAudioOffloadPauseTimeout() { if (offloadingAudio()) { + mWakeLock->acquire(); sp<AMessage> msg = new AMessage(kWhatAudioOffloadPauseTimeout, id()); msg->setInt32("generation", mAudioOffloadPauseTimeoutGeneration); msg->post(kOffloadPauseMaxUs); @@ -1393,6 +1398,7 @@ void NuPlayer::Renderer::startAudioOffloadPauseTimeout() { void NuPlayer::Renderer::cancelAudioOffloadPauseTimeout() { if (offloadingAudio()) { + mWakeLock->release(true); ++mAudioOffloadPauseTimeoutGeneration; } } diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h index 98fc44d..003d1d0 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h +++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.h @@ -23,6 +23,7 @@ namespace android { struct ABuffer; +class AWakeLock; struct VideoFrameScheduler; struct NuPlayer::Renderer : public AHandler { @@ -194,6 +195,8 @@ private: int32_t mTotalBuffersQueued; int32_t mLastAudioBufferDrained; + sp<AWakeLock> mWakeLock; + status_t getCurrentPositionOnLooper(int64_t *mediaUs); status_t getCurrentPositionOnLooper( int64_t *mediaUs, int64_t nowUs, bool allowPastQueuedVideo = false); |