Video Fix

This commit is contained in:
Brad Stein 2025-06-28 01:08:57 -05:00
parent c5ce41bb9a
commit d5323232fb

View File

@ -21,8 +21,8 @@ pub async fn eye_ball(
let desc = format!(
"v4l2src device={dev} io-mode=mmap ! \
video/x-h264,stream-format=byte-stream,alignment=au ! \
h264parse config-interval=1 ! \
video/x-h264,stream-format=byte-stream,alignment=au,profile=high ! \
h264parse config-interval=-1 ! \
appsink name=sink emit-signals=true drop=true sync=false"
);
@ -45,6 +45,9 @@ pub async fn eye_ball(
let sample = sink.pull_sample().map_err(|_| gst::FlowError::Eos)?;
let buffer = sample.buffer().ok_or(gst::FlowError::Error)?;
/* -------- map once, reuse ----- */
let map = buffer.map_readable().map_err(|_| gst::FlowError::Error)?;
/* -------- basic counters ------ */
static FRAME: std::sync::atomic::AtomicU64 =
std::sync::atomic::AtomicU64::new(0);
@ -52,10 +55,11 @@ pub async fn eye_ball(
if n % 120 == 0 {
// trace!("eye{id}: delivered {n} frames");
trace!(target: "lesavka_server::video", "eye{id}: delivered {n} frames");
if enabled!(Level::TRACE) {
let path = format!("/tmp/eye{id}-srv-{:05}.h264", n);
std::fs::write(&path, map.as_slice()).ok();
}
}
/* -------- map once, reuse ----- */
let map = buffer.map_readable().map_err(|_| gst::FlowError::Error)?;
// write first IDR to disk (quick sanity check)
if n == 0 {