pub struct FrameMeta {
pub frame_seq: u64,
pub tile_index: u16,
pub tile_count: u16,
pub x: u32,
pub y: u32,
pub w: u32,
pub h: u32,
pub screen_w: u32,
pub screen_h: u32,
pub captured_at_ms: u64,
}Expand description
Metadata for one tile, carried in NATS headers alongside the raw image payload.
Also Serialize/Deserialize: the same metadata travels as JSON over
the agent’s in-session IPC pipe, where there are no NATS headers to put
it in. One type describing a tile, two encodings of it depending on which
hop it is crossing — the alternative was a near-duplicate struct that
would drift the first time a field was added.
Fields§
§frame_seq: u64Monotonic per-session frame counter. Tiles of the same frame share it, which is what lets a viewer decide whether it is assembling a coherent picture or has started receiving the next one.
tile_index: u16Index of this tile within its frame, 0..tile_count.
tile_count: u16How many tiles this frame was split into. A viewer that has seen all of them can present the frame; one that is missing some can still paint what arrived — tiles are independent images, so a dropped tile degrades to a stale rectangle rather than a corrupt screen.
x: u32Tile origin in desktop pixels.
y: u32§w: u32Tile size in pixels.
h: u32§screen_w: u32Full desktop size, repeated on every tile.
Redundant by design: a viewer that joins mid-session, or reconnects, can size its canvas from the first tile it happens to receive without waiting for a control round-trip or a full frame.
screen_h: u32§captured_at_ms: u64Agent-side capture time, milliseconds since the Unix epoch.
For measuring one-way latency (#1140 risk 2 — whether control across the overlay is usable at all). Clocks are not synchronised between endpoint and backend, so treat the absolute value as untrustworthy; the differences between consecutive frames from one agent are what carry signal.
Implementations§
Source§impl FrameMeta
impl FrameMeta
Sourcepub fn to_headers(&self, encoding: TileEncoding) -> HeaderMap
pub fn to_headers(&self, encoding: TileEncoding) -> HeaderMap
Write this metadata into a NATS header map, together with the encoding (which lives outside the struct because it describes the payload, not the geometry).
Sourcepub fn from_headers(
h: &HeaderMap,
) -> Result<(Self, TileEncoding), FrameMetaError>
pub fn from_headers( h: &HeaderMap, ) -> Result<(Self, TileEncoding), FrameMetaError>
Parse metadata back out of a NATS header map.
Validates geometry as well as presence: a tile that claims to fall outside its own screen would otherwise reach a viewer’s canvas draw and either throw or silently paint nothing, far from the corrupt header that caused it.
Sourcepub fn validate(&self) -> Result<(), FrameMetaError>
pub fn validate(&self) -> Result<(), FrameMetaError>
Geometry sanity. Split out so a sender can check before publishing rather than leaving it to the receiver to reject.
Trait Implementations§
impl Copy for FrameMeta
Source§impl<'de> Deserialize<'de> for FrameMeta
impl<'de> Deserialize<'de> for FrameMeta
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for FrameMeta
impl StructuralPartialEq for FrameMeta
Auto Trait Implementations§
impl Freeze for FrameMeta
impl RefUnwindSafe for FrameMeta
impl Send for FrameMeta
impl Sync for FrameMeta
impl Unpin for FrameMeta
impl UnsafeUnpin for FrameMeta
impl UnwindSafe for FrameMeta
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.