YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.multiroom.engine.PlaybackTracker Class Reference

Keeps the latest trustworthy position of the output and extrapolates it: frame f is presented at
presentedAt + (f - frames) / rate
. More...

Collaboration diagram for de.yaacc.multiroom.engine.PlaybackTracker:
Collaboration graph

Public Member Functions

 PlaybackTracker (int sampleRate)
 
 PlaybackTracker (int sampleRate, long outlierMicros)
 
void reset (long nowMicros)
 Forget everything: the output was flushed at nowMicros, positions older than that do not count.
 
boolean update (PlaybackPosition position, long writtenFrames, long nowMicros)
 
boolean stepLooksStalled ()
 True when the newest step between two reports (20 ms or more apart) moved less than half the nominal frames.
 
boolean stalled (long nowMicros)
 True when the output stood still or crawled: the last two steps between reports (20 ms or more apart each) played less than half of the frames that the time asks for, so did the last 100 ms or more of reports taken together, and the newest report is not older than 400 ms (one odd report is no stall).
 
long outlierCount ()
 Reports that were held back because they were off the line (and not confirmed by the next one).
 
boolean isValid ()
 
long presentationMicros (long frame)
 The engine clock time at which the frame with this index (counted from the last flush) is presented.
 
long ageMicros (long nowMicros)
 How old the newest accepted position is, or -1 when there is none.
 
long acceptedCount ()
 
long rejectedCount ()
 
long revision ()
 Grows whenever a new position was taken or the tracker was reset.
 

Detailed Description

Keeps the latest trustworthy position of the output and extrapolates it: frame f is presented at
presentedAt + (f - frames) / rate
.

The platform's positions are sparse, may be stale after a flush, may stall during an underrun and (on Android) wrap at 32 bits, so a report is accepted only when it can be true: it must not lie before the last flush, must not be in the far future or old, must not claim more frames than were written, and must advance. Pure.

Constructor & Destructor Documentation

◆ PlaybackTracker()

de.yaacc.multiroom.engine.PlaybackTracker.PlaybackTracker ( int sampleRate,
long outlierMicros )
Parameters
outlierMicrosa report that is off the extrapolation of the last one by more than this is not taken at once: it must be confirmed by the next report (a lone odd report would make the engine think the output is far ahead or behind, and stop writing or skip audio)

Member Function Documentation

◆ stalled()

boolean de.yaacc.multiroom.engine.PlaybackTracker.stalled ( long nowMicros)

True when the output stood still or crawled: the last two steps between reports (20 ms or more apart each) played less than half of the frames that the time asks for, so did the last 100 ms or more of reports taken together, and the newest report is not older than 400 ms (one odd report is no stall).

A stalled output is not starved by definition (the data may be queued), it simply does not play.

◆ update()

boolean de.yaacc.multiroom.engine.PlaybackTracker.update ( PlaybackPosition position,
long writtenFrames,
long nowMicros )
Returns
true when the report was taken as a new position

The documentation for this class was generated from the following file: