void BMediaEventLooper::DispatchEvent(const media_timed_event *event, bigtime_t lateness, bool realTimeEvent) { PRINT(6, "CALLED BMediaEventLooper::DispatchEvent()\n"); HandleEvent(event, lateness, realTimeEvent); switch (event->type) { case BTimedEventQueue::B_START: SetRunState(B_STARTED); break; case BTimedEventQueue::B_STOP: SetRunState(B_STOPPED); break; case BTimedEventQueue::B_SEEK: /* nothing */ break; case BTimedEventQueue::B_WARP: /* nothing */ break; default: break; } _DispatchCleanUp(event); }
void BMediaEventLooper::Quit() { CALLED(); if (fRunState == B_TERMINATED) return; SetRunState(B_QUITTING); close_port(ControlPort()); if (fControlThread != -1) { status_t err; wait_for_thread(fControlThread, &err); fControlThread = -1; } SetRunState(B_TERMINATED); }
void BMediaEventLooper::Run() { CALLED(); if (fControlThread != -1) return; // thread already running // until now, the run state is B_UNREGISTERED, but we need to start in B_STOPPED state. SetRunState(B_STOPPED); char threadName[32]; sprintf(threadName, "%.20s control", Name()); fControlThread = spawn_thread(_ControlThreadStart, threadName, fCurrentPriority, this); resume_thread(fControlThread); // get latency information fSchedulingLatency = estimate_max_scheduling_latency(fControlThread); }