BMediaEventLooper: Return to simple lateness computation

* Remove enqueue_time again.
* Lateness seems generally useless. No way to get something useful
experimentally. The commit noise however was useful, the port wait is
behaving more in accordance with the lateness calculus.
* Fixes #12817 and possibly #12594.
This commit is contained in:
Dario Casalinuovo
2016-10-20 03:11:01 +02:00
parent 0c98ab27d3
commit 3588e74aef
3 changed files with 8 additions and 18 deletions
+1 -2
View File
@@ -38,9 +38,8 @@ struct media_timed_event {
int32 data;
int64 bigdata;
char user_data[64];
bigtime_t enqueue_time;
uint32 _reserved_media_timed_event_[6];
uint32 _reserved_media_timed_event_[8];
};
+7 -13
View File
@@ -239,19 +239,13 @@ BMediaEventLooper::ControlLoop()
if (err == B_OK) {
// The general idea of lateness is to allow
// the client code to detect when the buffer
// is handled late or early. What we add is
// that the code log the time at which the
// current event is added to the queue. This
// allow us to detect cyclic/stagnant latency
// in the meantime, so that the client can
// notify to the producer only the portion
// that might be attributable.
bigtime_t lateness = waitUntil - TimeSource()->RealTime();
if (lateness < 0 && event.enqueue_time > waitUntil) {
lateness = event.enqueue_time
- TimeSource()->RealTime();
}
DispatchEvent(&event, -lateness, hasRealtime);
// is handled late or early.
bigtime_t lateness = TimeSource()->RealTime() - waitUntil;
// Maximum amount of lateness we tolerate
if (lateness < 3000L)
lateness = 0;
DispatchEvent(&event, lateness, hasRealtime);
}
} else if (err != B_OK)
return;
@@ -78,9 +78,6 @@ _event_queue_imp::AddEvent(const media_timed_event &event)
return B_BAD_VALUE;
}
const_cast<media_timed_event&>(event).enqueue_time
= BTimeSource::RealTime();
//create a new queue
if (fFirstEntry == NULL) {
ASSERT(fEventCount == 0);