Loading libs/audioflinger/AudioFlinger.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -2277,10 +2277,8 @@ AudioFlinger::PlaybackThread::Track::~Track() LOGV("PlaybackThread::Track destructor"); sp<ThreadBase> thread = mThread.promote(); if (thread != 0) { thread->mLock.lock(); Mutex::Autolock _l(thread->mLock); mState = TERMINATED; thread->mLock.unlock(); AudioSystem::releaseOutput(thread->id()); } } Loading @@ -2298,9 +2296,12 @@ void AudioFlinger::PlaybackThread::Track::destroy() { // scope for mLock sp<ThreadBase> thread = mThread.promote(); if (thread != 0) { if (!isOutputTrack() && (mState == ACTIVE || mState == RESUMING)) { if (!isOutputTrack()) { if (mState == ACTIVE || mState == RESUMING) { AudioSystem::stopOutput(thread->id(), (AudioSystem::stream_type)mStreamType); } AudioSystem::releaseOutput(thread->id()); } Mutex::Autolock _l(thread->mLock); PlaybackThread *playbackThread = (PlaybackThread *)thread.get(); playbackThread->destroyTrack_l(this); Loading libs/surfaceflinger/SurfaceFlinger.cpp +17 −12 Original line number Diff line number Diff line Loading @@ -417,9 +417,9 @@ void SurfaceFlinger::waitForEvent() { while (true) { nsecs_t timeout = -1; const nsecs_t freezeDisplayTimeout = ms2ns(5000); if (UNLIKELY(isFrozen())) { // wait 5 seconds const nsecs_t freezeDisplayTimeout = ms2ns(5000); const nsecs_t now = systemTime(); if (mFreezeDisplayTime == 0) { mFreezeDisplayTime = now; Loading @@ -429,21 +429,25 @@ void SurfaceFlinger::waitForEvent() } MessageList::value_type msg = mEventQueue.waitMessage(timeout); if (msg != 0) { mFreezeDisplayTime = 0; switch (msg->what) { case MessageQueue::INVALIDATE: // invalidate message, just return to the main loop return; } } else { // we timed out // see if we timed out if (isFrozen()) { const nsecs_t now = systemTime(); nsecs_t frozenTime = (now - mFreezeDisplayTime); if (frozenTime >= freezeDisplayTimeout) { // we timed out and are still frozen LOGW("timeout expired mFreezeDisplay=%d, mFreezeCount=%d", mFreezeDisplay, mFreezeCount); mFreezeDisplayTime = 0; mFreezeCount = 0; mFreezeDisplay = false; } } if (msg != 0) { switch (msg->what) { case MessageQueue::INVALIDATE: // invalidate message, just return to the main loop return; } } Loading Loading @@ -1646,6 +1650,7 @@ status_t SurfaceFlinger::onTransact( } case 1007: // set mFreezeCount mFreezeCount = data.readInt32(); mFreezeDisplayTime = 0; return NO_ERROR; case 1010: // interrogate. reply->writeInt32(0); Loading libs/surfaceflinger/SurfaceFlinger.h +5 −1 Original line number Diff line number Diff line Loading @@ -291,7 +291,11 @@ private: friend class FreezeLock; sp<FreezeLock> getFreezeLock() const; inline void incFreezeCount() { mFreezeCount++; } inline void incFreezeCount() { if (mFreezeCount == 0) mFreezeDisplayTime = 0; mFreezeCount++; } inline void decFreezeCount() { if (mFreezeCount > 0) mFreezeCount--; } inline bool hasFreezeRequest() const { return mFreezeDisplay; } inline bool isFrozen() const { Loading Loading
libs/audioflinger/AudioFlinger.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -2277,10 +2277,8 @@ AudioFlinger::PlaybackThread::Track::~Track() LOGV("PlaybackThread::Track destructor"); sp<ThreadBase> thread = mThread.promote(); if (thread != 0) { thread->mLock.lock(); Mutex::Autolock _l(thread->mLock); mState = TERMINATED; thread->mLock.unlock(); AudioSystem::releaseOutput(thread->id()); } } Loading @@ -2298,9 +2296,12 @@ void AudioFlinger::PlaybackThread::Track::destroy() { // scope for mLock sp<ThreadBase> thread = mThread.promote(); if (thread != 0) { if (!isOutputTrack() && (mState == ACTIVE || mState == RESUMING)) { if (!isOutputTrack()) { if (mState == ACTIVE || mState == RESUMING) { AudioSystem::stopOutput(thread->id(), (AudioSystem::stream_type)mStreamType); } AudioSystem::releaseOutput(thread->id()); } Mutex::Autolock _l(thread->mLock); PlaybackThread *playbackThread = (PlaybackThread *)thread.get(); playbackThread->destroyTrack_l(this); Loading
libs/surfaceflinger/SurfaceFlinger.cpp +17 −12 Original line number Diff line number Diff line Loading @@ -417,9 +417,9 @@ void SurfaceFlinger::waitForEvent() { while (true) { nsecs_t timeout = -1; const nsecs_t freezeDisplayTimeout = ms2ns(5000); if (UNLIKELY(isFrozen())) { // wait 5 seconds const nsecs_t freezeDisplayTimeout = ms2ns(5000); const nsecs_t now = systemTime(); if (mFreezeDisplayTime == 0) { mFreezeDisplayTime = now; Loading @@ -429,21 +429,25 @@ void SurfaceFlinger::waitForEvent() } MessageList::value_type msg = mEventQueue.waitMessage(timeout); if (msg != 0) { mFreezeDisplayTime = 0; switch (msg->what) { case MessageQueue::INVALIDATE: // invalidate message, just return to the main loop return; } } else { // we timed out // see if we timed out if (isFrozen()) { const nsecs_t now = systemTime(); nsecs_t frozenTime = (now - mFreezeDisplayTime); if (frozenTime >= freezeDisplayTimeout) { // we timed out and are still frozen LOGW("timeout expired mFreezeDisplay=%d, mFreezeCount=%d", mFreezeDisplay, mFreezeCount); mFreezeDisplayTime = 0; mFreezeCount = 0; mFreezeDisplay = false; } } if (msg != 0) { switch (msg->what) { case MessageQueue::INVALIDATE: // invalidate message, just return to the main loop return; } } Loading Loading @@ -1646,6 +1650,7 @@ status_t SurfaceFlinger::onTransact( } case 1007: // set mFreezeCount mFreezeCount = data.readInt32(); mFreezeDisplayTime = 0; return NO_ERROR; case 1010: // interrogate. reply->writeInt32(0); Loading
libs/surfaceflinger/SurfaceFlinger.h +5 −1 Original line number Diff line number Diff line Loading @@ -291,7 +291,11 @@ private: friend class FreezeLock; sp<FreezeLock> getFreezeLock() const; inline void incFreezeCount() { mFreezeCount++; } inline void incFreezeCount() { if (mFreezeCount == 0) mFreezeDisplayTime = 0; mFreezeCount++; } inline void decFreezeCount() { if (mFreezeCount > 0) mFreezeCount--; } inline bool hasFreezeRequest() const { return mFreezeDisplay; } inline bool isFrozen() const { Loading