diff options
author | Andreas Huber <andih@google.com> | 2012-10-01 16:03:44 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2012-10-01 16:03:44 -0700 |
commit | af5dd7753e62353411cf0daf3b513c38818e9662 (patch) | |
tree | e935f45f925c4ce6d35d16764e2d40db69cc954a /media/libstagefright/TimedEventQueue.cpp | |
parent | 0868deae404604b577892413c128d55a2bafc56e (diff) | |
download | frameworks_av-af5dd7753e62353411cf0daf3b513c38818e9662.zip frameworks_av-af5dd7753e62353411cf0daf3b513c38818e9662.tar.gz frameworks_av-af5dd7753e62353411cf0daf3b513c38818e9662.tar.bz2 |
ALooper::GetNowUs() now relies on systemTime instead of gettimeofday.
Change-Id: Ia31eb0940b02581327a8bf51af6df135f9ab6de3
related-to-bug: 7266324
Diffstat (limited to 'media/libstagefright/TimedEventQueue.cpp')
-rw-r--r-- | media/libstagefright/TimedEventQueue.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp index 9df15eb..7e9c4bf 100644 --- a/media/libstagefright/TimedEventQueue.cpp +++ b/media/libstagefright/TimedEventQueue.cpp @@ -30,6 +30,7 @@ #include <sys/time.h> #include <media/stagefright/foundation/ADebug.h> +#include <media/stagefright/foundation/ALooper.h> namespace android { @@ -94,7 +95,7 @@ TimedEventQueue::event_id TimedEventQueue::postEventToBack( TimedEventQueue::event_id TimedEventQueue::postEventWithDelay( const sp<Event> &event, int64_t delay_us) { CHECK(delay_us >= 0); - return postTimedEvent(event, getRealTimeUs() + delay_us); + return postTimedEvent(event, ALooper::GetNowUs() + delay_us); } TimedEventQueue::event_id TimedEventQueue::postTimedEvent( @@ -179,14 +180,6 @@ void TimedEventQueue::cancelEvents( } // static -int64_t TimedEventQueue::getRealTimeUs() { - struct timeval tv; - gettimeofday(&tv, NULL); - - return (int64_t)tv.tv_sec * 1000000ll + tv.tv_usec; -} - -// static void *TimedEventQueue::ThreadWrapper(void *me) { androidSetThreadPriority(0, ANDROID_PRIORITY_FOREGROUND); @@ -225,7 +218,7 @@ void TimedEventQueue::threadEntry() { List<QueueItem>::iterator it = mQueue.begin(); eventID = (*it).event->eventID(); - now_us = getRealTimeUs(); + now_us = ALooper::GetNowUs(); int64_t when_us = (*it).realtime_us; int64_t delay_us; @@ -258,7 +251,7 @@ void TimedEventQueue::threadEntry() { if (!timeoutCapped && err == -ETIMEDOUT) { // We finally hit the time this event is supposed to // trigger. - now_us = getRealTimeUs(); + now_us = ALooper::GetNowUs(); break; } } |