BMediaEventLooper: Better solution for negative timestamp
* This problem happens only at the startup, so that it's preferred that we deal with it in the BMediaEventLooper side. * This solve some audio stability problems I had with slow systems.
This commit is contained in:
parent
ffeb987dc4
commit
bb1f15aade
@ -217,6 +217,7 @@ BMediaEventLooper::ControlLoop()
|
||||
bigtime_t waitUntil = B_INFINITE_TIMEOUT;
|
||||
bool hasRealtime = false;
|
||||
bool hasEvent = false;
|
||||
bool hasBooted = false;
|
||||
|
||||
// While there are no events or it is not time for the earliest event,
|
||||
// process messages using WaitForMessages. Whenever this funtion times out,
|
||||
@ -262,6 +263,15 @@ BMediaEventLooper::ControlLoop()
|
||||
waitUntil = TimeSource()->RealTimeFor(
|
||||
fEventQueue.FirstEventTime(),
|
||||
fEventLatency + fSchedulingLatency);
|
||||
|
||||
// The first event we handle will have
|
||||
// a negative startup wait. In this case
|
||||
// we just check the port and let the
|
||||
// first event to be executed just now.
|
||||
if (!hasBooted && waitUntil < 0) {
|
||||
waitUntil = 0;
|
||||
hasBooted = true;
|
||||
}
|
||||
} else if (!hasRealtime) {
|
||||
waitUntil = B_INFINITE_TIMEOUT;
|
||||
continue;
|
||||
|
@ -362,12 +362,6 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil, uint32 flags,
|
||||
int32 message;
|
||||
ssize_t size;
|
||||
|
||||
// TODO: Investigate on this issue
|
||||
if (waitUntil < 0) {
|
||||
TRACE("BMediaNode::WaitForMessage: Negative timeout!\n");
|
||||
waitUntil = 0;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
size = read_port_etc(ControlPort(), &message, data,
|
||||
sizeof(data), B_ABSOLUTE_TIMEOUT, waitUntil);
|
||||
|
Loading…
x
Reference in New Issue
Block a user