started work on offset propagation
This commit is contained in:
parent
a4ee67e5ae
commit
405dffb98b
4 changed files with 21 additions and 11 deletions
|
@ -134,7 +134,7 @@ class ScheduledEventInterface
|
||||||
* a separate thread, and return immediately.
|
* a separate thread, and return immediately.
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
start(void) throw () = 0;
|
start(Ptr<time_duration>::Ref offset) throw () = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The length of the event.
|
* The length of the event.
|
||||||
|
|
|
@ -105,8 +105,9 @@ SchedulerThread :: getCurrentEvent() throw ()
|
||||||
|
|
||||||
nextEvent = eventContainer->getCurrentEvent();
|
nextEvent = eventContainer->getCurrentEvent();
|
||||||
if (nextEvent.get()) {
|
if (nextEvent.get()) {
|
||||||
nextEventTime = TimeConversion::now();
|
//fake these events here so we can preload
|
||||||
nextInitTime.reset(new ptime(*nextEventTime));
|
nextInitTime.reset(new ptime(*TimeConversion::now() + *granularity));
|
||||||
|
nextEventTime.reset(new ptime(*nextInitTime + *nextEvent->maxTimeToInitialize()));
|
||||||
nextEventEnd.reset(new ptime(*nextEvent->getScheduledTime()
|
nextEventEnd.reset(new ptime(*nextEvent->getScheduledTime()
|
||||||
+ *nextEvent->eventLength()));
|
+ *nextEvent->eventLength()));
|
||||||
debug() << "::getCurrentEvent() - nextInitTime: "
|
debug() << "::getCurrentEvent() - nextInitTime: "
|
||||||
|
@ -144,12 +145,21 @@ SchedulerThread :: nextStep(Ptr<ptime>::Ref now) throw ()
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
} else if (imminent(now, nextEventTime)) {
|
} else if (imminent(now, nextEventTime)) {
|
||||||
|
Ptr<time_duration>::Ref timePassed(new time_duration(*now
|
||||||
|
- *nextEvent->getScheduledTime()));
|
||||||
|
Ptr<time_duration>::Ref timeNull(new time_duration(0, 0, 0, 0));
|
||||||
|
if(*timePassed > *timeNull) {
|
||||||
|
debug() << "::nextStep() with offset - Start [" << *TimeConversion::now()
|
||||||
|
<< "]" << endl;
|
||||||
|
nextEvent->start(timePassed);
|
||||||
|
} else {
|
||||||
Ptr<time_duration>::Ref timeLeft(new time_duration(*nextEventTime
|
Ptr<time_duration>::Ref timeLeft(new time_duration(*nextEventTime
|
||||||
- *now));
|
- *now));
|
||||||
TimeConversion::sleep(timeLeft);
|
TimeConversion::sleep(timeLeft);
|
||||||
debug() << "::nextStep() - Start [" << *TimeConversion::now()
|
debug() << "::nextStep() - Start [" << *TimeConversion::now()
|
||||||
<< "]" << endl;
|
<< "]" << endl;
|
||||||
nextEvent->start();
|
nextEvent->start(timeNull);
|
||||||
|
}
|
||||||
currentEvent = nextEvent;
|
currentEvent = nextEvent;
|
||||||
currentEventEnd = nextEventEnd;
|
currentEventEnd = nextEventEnd;
|
||||||
getNextEvent(TimeConversion::now());
|
getNextEvent(TimeConversion::now());
|
||||||
|
|
|
@ -149,7 +149,7 @@ PlaylistEvent :: deInitialize(void) throw ()
|
||||||
* Initialize the event object.
|
* Initialize the event object.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
PlaylistEvent :: start(void) throw ()
|
PlaylistEvent :: start(Ptr<time_duration>::Ref offset) throw ()
|
||||||
{
|
{
|
||||||
DEBUG_BLOCK
|
DEBUG_BLOCK
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ class PlaylistEvent : public virtual ScheduledEventInterface
|
||||||
* a separate thread, and return immediately.
|
* a separate thread, and return immediately.
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
start(void) throw ();
|
start(Ptr<time_duration>::Ref offset) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The length of the event.
|
* The length of the event.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue