pub enum FrameInclusion {
Never,
Always,
Sampled {
interval: u32,
},
TargetFps {
target: f32,
fallback_interval: u32,
},
}Expand description
Controls whether the source FrameEnvelope is included in the
OutputEnvelope.
Default is Never — output contains only
perception artifacts. Use Always when
downstream consumers need access to the pixel data (e.g., annotation
overlays, frame archival, or visual debugging).
Sampled provides a middle ground: frames
are included every interval outputs, keeping metadata (detections,
tracks, signals) at full rate while reducing the cost of host
materialization and downstream pixel processing in the sink thread.
For example, Sampled { interval: 6 } on a 30 fps source yields
~5 fps of frame delivery while perception runs at full rate.
Because FrameEnvelope is Arc-backed, inclusion is zero-copy.
Variants§
Never
Never include frames in output (default).
Always
Always include the source frame in output.
Sampled
Include the source frame every interval outputs.
Perception artifacts (detections, tracks, signals, provenance) flow at full rate regardless. Only the pixel payload is gated.
An interval of 1 behaves like Always.
An interval of 0 behaves like Never.
TargetFps
Include frames at a target preview FPS, resolved dynamically from the observed source rate.
During a warmup window (first ~30 frames), fallback_interval is
used. Once the source FPS is estimated, the interval is computed
as round(source_fps / target_fps) and the variant is resolved
in-place to Sampled.
This avoids hardcoding an assumed source FPS at config time.
Implementations§
Source§impl FrameInclusion
impl FrameInclusion
Sourcepub fn target_fps(target: f32, fallback_interval: u32) -> Self
pub fn target_fps(target: f32, fallback_interval: u32) -> Self
Create a target-FPS frame inclusion that resolves dynamically from the observed source rate.
Until the source rate is known (warmup window), falls back to
fallback_interval. Once observed, resolves to Sampled.
fallback_interval is normalized: 0 → Never, 1 → Always.
Sourcepub fn from_target_fps(target_fps: f32, assumed_source_fps: f32) -> Self
pub fn from_target_fps(target_fps: f32, assumed_source_fps: f32) -> Self
Compute a sampled frame inclusion from a target preview FPS and an assumed source FPS.
The interval is round(source / target), clamped to valid range.
For runtime-adaptive behavior, prefer target_fps
which resolves from observed source rate instead of a static assumption.
§Examples
assert_eq!(
FrameInclusion::from_target_fps(5.0, 30.0),
FrameInclusion::Sampled { interval: 6 },
);
assert_eq!(
FrameInclusion::from_target_fps(60.0, 30.0),
FrameInclusion::Always,
);Sourcepub fn effective_interval(&self) -> u32
pub fn effective_interval(&self) -> u32
Sourcepub fn resolve_with_source_fps(self, source_fps: f32) -> Self
pub fn resolve_with_source_fps(self, source_fps: f32) -> Self
Trait Implementations§
Source§impl Clone for FrameInclusion
impl Clone for FrameInclusion
Source§fn clone(&self) -> FrameInclusion
fn clone(&self) -> FrameInclusion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FrameInclusion
impl Debug for FrameInclusion
Source§impl Default for FrameInclusion
impl Default for FrameInclusion
Source§fn default() -> FrameInclusion
fn default() -> FrameInclusion
Source§impl PartialEq for FrameInclusion
impl PartialEq for FrameInclusion
impl Copy for FrameInclusion
impl StructuralPartialEq for FrameInclusion
Auto Trait Implementations§
impl Freeze for FrameInclusion
impl RefUnwindSafe for FrameInclusion
impl Send for FrameInclusion
impl Sync for FrameInclusion
impl Unpin for FrameInclusion
impl UnsafeUnpin for FrameInclusion
impl UnwindSafe for FrameInclusion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more