PreRollState
public sealed record PreRollState : IEquatable<PreRollState>
What the pre-roll buffer is actually doing, as opposed to what was asked for.
Both numbers can differ from the request: a duration below the camera's frame period is raised to one frame, and a depth that would cost more than ThermalCamera.PreRollMemoryBudget is cut to fit. An application showing the user "3 s of pre-roll" should show this rather than the value it passed in.
PreRollState: constructors
public PreRollState(bool Enabled, TimeSpan Duration, uint Frames, uint Buffered, TimeSpan Held = default, bool HoldsDuration = false)
What the pre-roll buffer is actually doing, as opposed to what was asked for.
Enabled: Whether frames are being buffered.Duration: The duration in force.TimeSpan.Zerowhen disabled.Frames: How many frames the ring can hold, at the sensor's rate. A memory bound rather than the history's length: a camera delivering more slowly than its sensor rate reachesDurationlong before it reaches this, and may never reach this at all.Buffered: How many frames are in it right now. Not to be compared againstFrames, seeHoldsDuration.Held: The span the ring actually holds: its newest frame's timestamp less its oldest.TimeSpan.Zerowhen fewer than two frames are in it. This is the number to show as "the pre-roll holds 4.8 of 5 s".Bufferedis a frame count against a capacity derived from the sensor's rate, and a camera does not always deliver at that rate: subsampled, or restricted to 9 fps. A 32 Hz camera delivering 9 fps with 5 s armed holds its whole 5 s in about 45 of its 160 frames, so the counts read 28 % while the buffer is full. It tops out just underDurationrather than at it, because a span is measured between two stamps and so falls one delivered frame period short. That period is the one number an application has not got, which is whyHoldsDurationexists.HoldsDuration: Whether the ring holds all the history it was asked for. The test to wait on before starting a recording. True once either bound has bitten (a frame evicted for being older thanDuration, or the frame count reachingFrames), so it covers a camera delivering below its sensor rate and one delivering above it, with no tolerance to choose.falseagain immediately after a recording starts: the start hands the whole ring to the write queue, so the pre-roll begins refilling from nothing. A chip driven from this therefore goes back to "filling" at each start, which an application's own timer did not.
Both numbers can differ from the request: a duration below the camera's frame period is raised to one frame, and a depth that would cost more than ThermalCamera.PreRollMemoryBudget is cut to fit. An application showing the user "3 s of pre-roll" should show this rather than the value it passed in.
PreRollState: properties
public uint Buffered { get; init; }
How many frames are in it right now. Not to be compared against Frames, see HoldsDuration.
public TimeSpan Duration { get; init; }
The duration in force. TimeSpan.Zero when disabled.
public bool Enabled { get; init; }
Whether frames are being buffered.
public uint Frames { get; init; }
How many frames the ring can hold, at the sensor's rate. A memory bound rather than the history's length: a camera delivering more slowly than its sensor rate reaches Duration long before it reaches this, and may never reach this at all.
public TimeSpan Held { get; init; }
The span the ring actually holds: its newest frame's timestamp less its oldest. TimeSpan.Zero when fewer than two frames are in it.
This is the number to show as "the pre-roll holds 4.8 of 5 s". Buffered is a frame count against a capacity derived from the sensor's rate, and a camera does not always deliver at that rate: subsampled, or restricted to 9 fps. A 32 Hz camera delivering 9 fps with 5 s armed holds its whole 5 s in about 45 of its 160 frames, so the counts read 28 % while the buffer is full.
It tops out just under Duration rather than at it, because a span is measured between two stamps and so falls one delivered frame period short. That period is the one number an application has not got, which is why HoldsDuration exists.
public bool HoldsDuration { get; init; }
Whether the ring holds all the history it was asked for.
The test to wait on before starting a recording. True once either bound has bitten (a frame evicted for being older than Duration, or the frame count reaching Frames), so it covers a camera delivering below its sensor rate and one delivering above it, with no tolerance to choose.
false again immediately after a recording starts: the start hands the whole ring to the write queue, so the pre-roll begins refilling from nothing. A chip driven from this therefore goes back to "filling" at each start, which an application's own timer did not.