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; int32 data;
int64 bigdata; int64 bigdata;
char user_data[64]; 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) { if (err == B_OK) {
// The general idea of lateness is to allow // The general idea of lateness is to allow
// the client code to detect when the buffer // the client code to detect when the buffer
// is handled late or early. What we add is // is handled late or early.
// that the code log the time at which the bigtime_t lateness = TimeSource()->RealTime() - waitUntil;
// current event is added to the queue. This // Maximum amount of lateness we tolerate
// allow us to detect cyclic/stagnant latency if (lateness < 3000L)
// in the meantime, so that the client can lateness = 0;
// notify to the producer only the portion
// that might be attributable. DispatchEvent(&event, lateness, hasRealtime);
bigtime_t lateness = waitUntil - TimeSource()->RealTime();
if (lateness < 0 && event.enqueue_time > waitUntil) {
lateness = event.enqueue_time
- TimeSource()->RealTime();
}
DispatchEvent(&event, -lateness, hasRealtime);
} }
} else if (err != B_OK) } else if (err != B_OK)
return; return;
@@ -78,9 +78,6 @@ _event_queue_imp::AddEvent(const media_timed_event &event)
return B_BAD_VALUE; return B_BAD_VALUE;
} }
const_cast<media_timed_event&>(event).enqueue_time
= BTimeSource::RealTime();
//create a new queue //create a new queue
if (fFirstEntry == NULL) { if (fFirstEntry == NULL) {
ASSERT(fEventCount == 0); ASSERT(fEventCount == 0);