diff --git a/src/engine/mod.rs b/src/engine/mod.rs index 7511bab..7d37a67 100644 --- a/src/engine/mod.rs +++ b/src/engine/mod.rs @@ -800,8 +800,17 @@ pub fn compose_osd_and_publish( } } + // En mode Bureau (sans OpenXR), pousser chaque nouvelle trame immédiatement (<= 4 ms) + // pour éliminer le bridage artificiel à 30 Hz (33 ms). En VR OpenXR, garder 33 ms pour + // ne pas voler de bande passante GPU au casque. + let preview_min_interval = if render_cpu_osd { + Duration::from_millis(4) + } else { + Duration::from_millis(33) + }; let push_preview = ctx.control.is_preview_active() - && last_preview_push.is_none_or(|t| t.elapsed() >= Duration::from_millis(33)); + && (has_new_raw_frame || !has_video_stream) + && last_preview_push.is_none_or(|t| t.elapsed() >= preview_min_interval); if push_preview || fps_timer.elapsed() >= Duration::from_secs(1) || frame_received_at.is_some() { if push_preview || fps_timer.elapsed() >= Duration::from_secs(1) { diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 255584b..3f9e8e3 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -1114,7 +1114,7 @@ pub fn run_gpui_app(cfg: AppConfig, log_buffer: Arc>) -> Result window .spawn(cx, async move |cx| { loop { - Timer::after(Duration::from_millis(16)).await; + Timer::after(Duration::from_millis(8)).await; let should_continue = cx .update(|window, cx| { if let Some(view) = weak_view.upgrade() { diff --git a/src/video_usb.rs b/src/video_usb.rs index ca88493..a980d14 100644 --- a/src/video_usb.rs +++ b/src/video_usb.rs @@ -460,14 +460,14 @@ fn select_best_decoder(is_h264: bool, allow_hw: bool) -> (&'static str, &'static let candidates: &[(&str, &str)] = if is_h264 { &[ ("v4l2h264dec", "v4l2h264dec"), - ("vah264dec", "vah264dec"), - ("vaapih264dec", "vaapih264dec"), + ("vah264dec", "vah264dec compliance=flexible"), + ("vaapih264dec", "vaapih264dec low-latency=true"), ] } else { &[ ("v4l2h265dec", "v4l2h265dec"), ("vah265dec", "vah265dec"), - ("vaapih265dec", "vaapih265dec"), + ("vaapih265dec", "vaapih265dec low-latency=true"), ] }; for &(factory_name, elem_desc) in candidates { @@ -479,12 +479,12 @@ fn select_best_decoder(is_h264: bool, allow_hw: bool) -> (&'static str, &'static if is_h264 { ( "avdec_h264", - "avdec_h264 max-threads=2 discard-corrupted-frames=true", + "avdec_h264 max-threads=2 thread-type=slice output-corrupt=true", ) } else { ( "avdec_h265", - "avdec_h265 max-threads=2 discard-corrupted-frames=true", + "avdec_h265 max-threads=2 thread-type=slice output-corrupt=true", ) } } @@ -510,9 +510,9 @@ fn pipeline_description_with_decoder(p: &PipelineParams, decoder_desc: &str) -> "h265parse name=nal_parser" }; let stream_caps = if is_h264 { - "video/x-h264,stream-format=byte-stream" + "video/x-h264,stream-format=byte-stream,alignment=au" } else { - "video/x-h265,stream-format=byte-stream" + "video/x-h265,stream-format=byte-stream,alignment=au" }; let codec_name = if is_h264 { "H264" } else { "H265" }; let depay = if is_h264 { "rtph264depay" } else { "rtph265depay" };