diff options
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 8 | ||||
-rw-r--r-- | media/libstagefright/TimedEventQueue.cpp | 6 |
2 files changed, 13 insertions, 1 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index e7cfc78..be6719a 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -798,7 +798,9 @@ void AwesomePlayer::onBufferingUpdate() { } } - postBufferingEvent_l(); + if (mFlags & (PLAYING | PREPARING)) { + postBufferingEvent_l(); + } } void AwesomePlayer::sendCacheStats() { @@ -1001,6 +1003,10 @@ status_t AwesomePlayer::play_l() { } addBatteryData(params); + if (isStreamingHTTP()) { + postBufferingEvent_l(); + } + return OK; } diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp index 74c5905..6a16bb4 100644 --- a/media/libstagefright/TimedEventQueue.cpp +++ b/media/libstagefright/TimedEventQueue.cpp @@ -33,6 +33,8 @@ #include <media/stagefright/foundation/ALooper.h> #include <binder/IServiceManager.h> #include <powermanager/PowerManager.h> +#include <binder/IPCThreadState.h> +#include <utils/CallStack.h> namespace android { @@ -327,10 +329,12 @@ void TimedEventQueue::acquireWakeLock_l() } if (mPowerManager != 0) { sp<IBinder> binder = new BBinder(); + int64_t token = IPCThreadState::self()->clearCallingIdentity(); status_t status = mPowerManager->acquireWakeLock(POWERMANAGER_PARTIAL_WAKE_LOCK, binder, String16("TimedEventQueue"), String16("media")); + IPCThreadState::self()->restoreCallingIdentity(token); if (status == NO_ERROR) { mWakeLockToken = binder; } @@ -343,7 +347,9 @@ void TimedEventQueue::releaseWakeLock_l() return; } if (mPowerManager != 0) { + int64_t token = IPCThreadState::self()->clearCallingIdentity(); mPowerManager->releaseWakeLock(mWakeLockToken, 0); + IPCThreadState::self()->restoreCallingIdentity(token); } mWakeLockToken.clear(); } |