BMediaEventLooper: Make lateness calculus in real time

* After having this patch applied locally for some time,
I'm going to be sure that we have to deal only with real_time values.
* Since RealTime() is just a system_time() wrapper, the code
will be slightly improved in performances too.
* Additionally it performs very well when the thread is
externally stopped (such as debugging it), so that the audio
recover almost immediately.
This commit is contained in:
Dario Casalinuovo
2016-02-03 13:25:13 +01:00
parent 4e7b05cca2
commit ffeb987dc4
+2 -3
View File
@@ -241,12 +241,11 @@ BMediaEventLooper::ControlLoop()
err = fRealTimeQueue.RemoveFirstEvent(&event);
if (err == B_OK) {
// We are going to do this calculus in performance time
// We are going to do this calculus in real time
// because otherwise we could get erroneous values.
// This calculus allow us to detect both early and late
// buffers, this is the meaning of the lateness concept.
bigtime_t lateness = event.event_time - fEventLatency
- fSchedulingLatency - TimeSource()->Now();
bigtime_t lateness = waitUntil - TimeSource()->RealTime();
DispatchEvent(&event, -lateness, hasRealtime);
}
} else if (err != B_OK)