diff options
author | Weiyin Jiang <wjiang@codeaurora.org> | 2015-01-28 16:14:02 +0800 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2015-02-06 16:32:24 -0800 |
commit | 35d5af131c9d4962e935082f204ccd6a2130861c (patch) | |
tree | 3a0456f7e9ddba7cddb0769f2a15d1589f820647 /media/libmediaplayerservice | |
parent | 17e95f40a534101e2df48f077a8029430adef6c3 (diff) | |
download | frameworks_av-35d5af131c9d4962e935082f204ccd6a2130861c.zip frameworks_av-35d5af131c9d4962e935082f204ccd6a2130861c.tar.gz frameworks_av-35d5af131c9d4962e935082f204ccd6a2130861c.tar.bz2 |
nuplayer: acquire wakelock during offload pause timeout
Hold a wakelock while paused in audio offload mode, until audio
teardown event is received, or pause is canceled.
Since ARM cores are sleeping, the delayed AMessage will not be
received, and the audio output driver will not be closed.
This blocks XO shutdown.
Bug: 19297092
Change-Id: I3d11fef633e3f2783f4aa31e71285e2fa09d234c
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); |