PreRollState
class optris_sdk.recording.PreRollState
What the pre-roll buffer is doing.
- Attribute
enabled— whether a buffer is armed at all. - Attribute
duration_s— how much history it was asked to keep, in seconds. - Attribute
frames— how many frames that works out to at the sensor's rate. A memory bound rather than the history's length: a camera delivering more slowly than its sensor rate reachesduration_slong before it reaches this, and may never reach this at all. - Attribute
buffered— how many are in it now. Not to be compared againstframes-- seefull. - Attribute
held_s— the span the buffer actually holds, in seconds: its newest frame's timestamp less its oldest. This is the number to show as "the pre-roll holds 4.8 of 5 s". It tops out just underduration_s, because a span is measured between two stamps and so falls one delivered frame period short. - Attribute
holds_duration— whether the buffer holds all the history it was asked for. The SDK's own answer, and whatfullreturns.
PreRollState — properties
full
Whether the buffer holds all the history it was asked for.
This used to be buffered >= frames, and on a camera that
delivers fewer frames than its sensor's rate -- subsampled
through optris_sdk.processing.Processing or restricted
to 9 fps -- that comparison is never true, however long
the buffer is armed: the capacity comes from the sensor rate
and the buffer is bounded by time. A 32 Hz camera delivering
9 fps with 5 s armed holds its whole 5 s in about 45 of its
160 frames.
So a loop waiting for this to become true waited for ever on
such a camera -- and the documentation on
optris_sdk.camera.Camera.enable_pre_roll told callers
to write that loop. It is now holds_duration, which
the SDK computes from which of the two bounds actually bit.