<aside> ⚠️

This page is synced from GitHub. Edits will be overwritten.

Source: https://github.com/uwrealitylabs/standalone-knowledge-base/blob/main/docs/runtime/Sinks.md

Last synced: 2026-11-01 23:20:27 UTC

</aside>

Sinks

Part of Monado headset driver.

Source references are to uwrealitylabs/standalone-monado-driver, branch dev at 6bbefe8, as path:line relative to src/xrt/. Line numbers drift; search by symbol if one is off.

A sink is an object that receives data through a single push function. Capture-to-tracker plumbing in Monado is a graph of sinks: producers push into sinks; some sinks are endpoints (trackers), others process the data and push it onward (queues, splitters, converters). A push is a plain function call, so the receiver's code runs on the pusher's thread. Every thread hop in the graph is an explicit queue node.

Interfaces

Interface Push function Carries Defined at
xrt_frame_sink push_frame(sink, struct xrt_frame *) One camera image (refcounted) include/xrt/xrt_frame.h:57; helper xrt_sink_push_frame :73
xrt_imu_sink push_imu(sink, struct xrt_imu_sample *) One IMU reading include/xrt/xrt_tracking.h:183
xrt_pose_sink push_pose(sink, struct xrt_pose_sample *) Timestamped pose (ground truth) xrt_tracking.h:196
xrt_device_masks_sink push_device_masks(sink, struct xrt_device_masks_sample *) Per-camera-view bounding boxes, one per device (e.g. each hand) xrt_tracking.h:206
xrt_slam_sinks none (container) Pointers: cams[], imus[], gt, masks[], plus counts. Null means disabled xrt_tracking.h:216

Implementations embed the interface struct in their own struct and recover themselves with container_of. Example: t_slam_receive_cam##N does container_of(sink, TrackerSlam, cam_sinks[N]) (auxiliary/tracking/t_tracker_slam.cpp:1357).

Data types

xrt_frame (include/xrt/xrt_frame.h:24), one camera image:

Field Meaning
reference, destroy, owner Refcount and release callback; lets a producer wrap a driver buffer and get it back when the last consumer drops it
width, height, stride, size, data Dimensions, row pitch in bytes, total size, CPU pointer to pixels
format xrt_format: L8, RGB variants, YUYV/UYVY, Bayer, etc.
stereo_format Single view or a stereo pair in one image (e.g. side-by-side)
timestamp, source_timestamp ns. timestamp in Monado's monotonic clock; source_timestamp keeps the device's original clock
source_sequence, source_id Frame counter; originating xrt_fs

xrt_imu_sample: timestamp_ns, accel_m_s2 and gyro_rad_secs as xrt_vec3_f64, in the IMU's own axes, SI units.

xrt_pose_sample: timestamped pose from an external reference. Evaluation and recording only.

xrt_device_masks_sample (include/xrt/xrt_tracking.h:161): per camera view, one optional rectangle per device. Mercury pushes hand bounding boxes so SLAM ignores features on moving hands.

xrt_slam_sinks: the index in cams[] is the camera index the calibration refers to. The hand-tracking async wrapper reuses the type for its two inputs (cams[0] left, cams[1] right).

Contract points for our headset