diff --git a/src/kits/media/MediaEventLooper.cpp b/src/kits/media/MediaEventLooper.cpp index 8cb3f22975..85af33acc6 100644 --- a/src/kits/media/MediaEventLooper.cpp +++ b/src/kits/media/MediaEventLooper.cpp @@ -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; diff --git a/src/kits/media/MediaNode.cpp b/src/kits/media/MediaNode.cpp index 5f2ab4fa20..362c3f3919 100644 --- a/src/kits/media/MediaNode.cpp +++ b/src/kits/media/MediaNode.cpp @@ -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);