summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/TimedEventQueue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/libstagefright/TimedEventQueue.cpp')
-rw-r--r--media/libstagefright/TimedEventQueue.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp
index fa68771..d079e70 100644
--- a/media/libstagefright/TimedEventQueue.cpp
+++ b/media/libstagefright/TimedEventQueue.cpp
@@ -135,7 +135,9 @@ static bool MatchesEventID(
}
bool TimedEventQueue::cancelEvent(event_id id) {
- CHECK(id != 0);
+ if (id == 0) {
+ return false;
+ }
cancelEvents(&MatchesEventID, &id, true /* stopAfterFirstMatch */);
@@ -162,6 +164,7 @@ void TimedEventQueue::cancelEvents(
mQueueHeadChangedCondition.signal();
}
+ (*it).event->setEventID(0);
it = mQueue.erase(it);
if (stopAfterFirstMatch) {
@@ -228,7 +231,12 @@ void TimedEventQueue::threadEntry() {
}
}
+ if (mQueue.empty()) {
+ continue;
+ }
+
event = (*it).event;
+ event->setEventID(0);
mQueue.erase(it);
}