BMediaEventLooper: Handle events in past differently

* When the loop didn't handle an event in performance time, we will
attempt at reading the port only if there are messages using a null
timeout.
This commit is contained in:
Dario Casalinuovo
2016-05-07 22:22:55 +02:00
parent e042d9ebff
commit f2bb946bd8
+6 -8
View File
@@ -269,13 +269,6 @@ BMediaEventLooper::ControlLoop()
waitUntil = TimeSource()->RealTimeFor( waitUntil = TimeSource()->RealTimeFor(
fEventQueue.FirstEventTime(), fEventQueue.FirstEventTime(),
fEventLatency + fSchedulingLatency); fEventLatency + fSchedulingLatency);
// TODO: At boot the wait time go
// to negative depending on the system
// speed, this should be fixed.
if (waitUntil < 0)
waitUntil = 0;
} else if (!hasRealtime) } else if (!hasRealtime)
waitUntil = B_INFINITE_TIMEOUT; waitUntil = B_INFINITE_TIMEOUT;
@@ -289,7 +282,12 @@ BMediaEventLooper::ControlLoop()
} else } else
hasRealtime = false; hasRealtime = false;
} }
err = WaitForMessage(waitUntil);
if (waitUntil != B_INFINITE_TIMEOUT
&& TimeSource()->RealTime() >= waitUntil) {
err = WaitForMessage(0);
} else
err = WaitForMessage(waitUntil);
} }
} }