perf(core): apply code-review optimizations for latency, allocations and concurrency

- LogBuffer: add revision counter and sync only latest 50 entries when revision changes, eliminating ~180k heap string allocations/sec.
- Engine: move dome_lut.apply outside of latest_frame lock guard to prevent GStreamer appsink thread contention.
- Video: reuse existing Vec buffer in appsink callback, render standby pattern in-place to avoid 3.7MB/frame alloc.
- GPUI: remove premature texture drain on idle ticks, spawn background threads for bash/ssh scripts to avoid zombie processes.
- Nomad: add NaN guard in deg_to_crsf, track last_send_ok to prevent permanent error state latch, add CRSF packet & CRC8 unit tests.
- OpenXR/Engine: enforce Acquire/Release ordering on atomic control flags, join worker thread reliably on stop.
This commit is contained in:
bleackstorm committed 2026-11-05 21:46:14 +01:00
1 parent 0fbe184716
commit 5d81993bbe
6 files changed
+140 -73

No files matched your search

+23 -12
View File
@@ -53,7 +53,7 @@ impl UsbVideoReceiver {
decodebin ! \
videoconvert ! videoscale ! \
video/x-raw,format=RGBA,width={target_width},height={target_height} ! \
appsink name=fpv_sink sync=false max-buffers=1 drop=true emit-signals=true"
appsink name=fpv_sink sync=false max-buffers=1 drop=true emit-signals=false"
)
} else {
let codec_lower = codec.to_lowercase();
@@ -88,7 +88,7 @@ impl UsbVideoReceiver {
{decoder} ! \
videoscale ! videoconvert ! \
video/x-raw,format=RGBA,width={target_width},height={target_height} ! \
appsink name=fpv_sink sync=false max-buffers=1 drop=true emit-signals=true"
appsink name=fpv_sink sync=false max-buffers=1 drop=true emit-signals=false"
)
};
@@ -136,13 +136,22 @@ impl UsbVideoReceiver {
}
let mut lock = frame_store.lock();
*lock = Some(VideoFrame {
width: video_info.width(),
height: video_info.height(),
rgba_data: map.as_slice().to_vec(),
frame_id: sequence,
received_at: Instant::now(),
});
if let Some(ref mut vf) = *lock {
vf.width = video_info.width();
vf.height = video_info.height();
vf.frame_id = sequence;
vf.received_at = Instant::now();
vf.rgba_data.clear();
vf.rgba_data.extend_from_slice(map.as_slice());
} else {
*lock = Some(VideoFrame {
width: video_info.width(),
height: video_info.height(),
rgba_data: map.as_slice().to_vec(),
frame_id: sequence,
received_at: Instant::now(),
});
}
Ok(gst::FlowSuccess::Ok)
})
@@ -205,8 +214,11 @@ impl UsbVideoReceiver {
Arc::clone(&self.latest_frame)
}
pub fn generate_standby_pattern(width: u32, height: u32, tick: u32) -> Vec<u8> {
let mut data = vec![0u8; (width * height * 4) as usize];
pub fn render_standby_pattern(width: u32, height: u32, tick: u32, data: &mut [u8]) {
let expected_len = (width * height * 4) as usize;
if data.len() < expected_len {
return;
}
let cx = (width / 2) as i32;
let cy = (height / 2) as i32;
let pulse = ((tick % 120) as f32 / 120.0 * std::f32::consts::TAU).sin() * 0.5 + 0.5;
@@ -235,7 +247,6 @@ impl UsbVideoReceiver {
}
}
}
data
}
}