handling of real time start offset

decision: the base for any deadline calculations
is the expected real time corresponding to the grid origin.
This value is contained in the Timings record.
This commit is contained in:
Fischlurch 2013-01-12 08:36:35 +01:00
parent 72e5557d1e
commit 18605b0c19
4 changed files with 33 additions and 22 deletions

View file

@ -75,7 +75,7 @@ namespace engine {
Time relatedRealTime_;
Time
expectedTimeofArival (play::Timings const& timings, Offset engineLatency)
expectedTimeofArival (play::Timings const& timings, int64_t startFrame, Offset engineLatency)
{
TimeVar deadline;
switch (timings.playbackUrgency)
@ -86,7 +86,7 @@ namespace engine {
break;
case play::TIMEBOUND:
deadline = timings.getTimeDue() - engineLatency;
deadline = timings.getTimeDue(startFrame) - engineLatency;
break;
}
return deadline - timings.outputLatency;
@ -96,7 +96,7 @@ namespace engine {
TimeAnchor (play::Timings timings, Offset engineLatency, int64_t startFrame)
: timings_(timings)
, anchorPoint_(startFrame)
, relatedRealTime_(expectedTimeofArival(timings, engineLatency))
, relatedRealTime_(expectedTimeofArival(timings,startFrame,engineLatency))
{ }
public:

View file

@ -60,11 +60,14 @@ namespace play {
: grid_(buildStandardGridForFramerate(fps))
, playbackUrgency (ASAP)
, playbackSpeed (1)
, scheduledDelivery(Time::NEVER)
, outputLatency (Duration::NIL)
{
ENSURE (grid_);
}
//////////////////////////////////////////////////////////////////TODO ctors for use in the real player/engine
TimeValue
@ -111,11 +114,13 @@ namespace play {
Time
Timings::getTimeDue() const
Timings::getTimeDue(int64_t frameOffset) const
{
if (TIMEBOUND == playbackUrgency)
{
UNIMPLEMENTED ("scheduled delivery spec");
REQUIRE (scheduledDelivery != Time::NEVER);
return scheduledDelivery
+ getRealOffset (frameOffset);
}
else
return Time::NEVER;
@ -132,8 +137,8 @@ namespace play {
}
uint
Timings::getPlanningChunkSize() const
Duration
Timings::getPlanningChunkDuration() const
{
UNIMPLEMENTED ("how to control the engine evaluation chunk size");
}

View file

@ -101,6 +101,7 @@ namespace play {
public:
PlaybackUrgency playbackUrgency;
boost::rational<int64_t> playbackSpeed; /////////////TICKET #902 we need a more generic representation for variable speed playback
Time scheduledDelivery;
Duration outputLatency;
Timings (FrameRate fps);
@ -119,14 +120,6 @@ namespace play {
* to assume unaltered frame dimensions */
Duration constantFrameTimingsInterval (TimeValue startPoint) const;
/** for scheduled time of delivery, which is signalled
* by \code playbackUrgency == TIMEBOUND \endcode
* @return wall clock time to expect delivery of data corresponding
* to \link #getOrigin time axis origin \endlink
* @note for other playback urgencies \c Time::NEVER
*/
Time getTimeDue() const;
/** calculate the given frame's distance from origin,
* but do so using the real time scale, including any
* playback speed factory and similar corrections.
@ -139,12 +132,25 @@ namespace play {
*/
Offset getRealOffset (int64_t frameOffset) const;
/** number of jobs to be planned and scheduled in one sway.
* The continuous planning of additional frame calculation jobs
* for playback or rendering proceeds in chunks of jobs
* controlled by this chunk size.
/** real time deadline for the given frame, without any latency.
* This value is provided in case of scheduled time of delivery,
* which is signalled by \code playbackUrgency == TIMEBOUND \endcode
* @return wall clock time to expect delivery of data
* corresponding to a frame specified relative
* to \link #getOrigin time axis origin \endlink
* @note for other playback urgencies \c Time::NEVER
*/
uint getPlanningChunkSize() const;
Time getTimeDue(int64_t frameOffset) const;
/** the minimum time span to be covered by frame calculation jobs
* planned in one sway. The ongoing planning of additional jobs
* proceeds in chunks of jobs added at once to the schedule.
* This setting defines the minimum time to plan ahead; after
* covering at least this time span with new jobs, the
* frame dispatcher concludes "enough for now" and emits
* a continuation job for the next planning chunk.
*/
Duration getPlanningChunkDuration() const;
bool isOriginalSpeed() const;

View file

@ -205,8 +205,8 @@ namespace test {
lib::append_all (jobs, plannedChunk);
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #880
uint chunksize = plannedChunk.size();
CHECK (chunksize == timings.getPlanningChunkSize());
Duration coveredTime (refPoint, last(plannedChunk).getNominalTime());
CHECK (coveredTime >= timings.getPlanningChunkDuration());
TimeVar nextFrameStart (refPoint);
InvocationInstanceID prevInvocationID(0);