diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 67c86f0..92e35e5 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -3,6 +3,7 @@
+
idVendor
+ echo 0xa4a1 > idProduct
+ echo 0x0100 > bcdDevice
+ echo 0x0200 > bcdUSB
+ echo 0x00 > bDeviceClass
+ echo 0x00 > bDeviceSubClass
+ echo 0x00 > bDeviceProtocol
+
+ mkdir -p strings/0x409
+ echo "SF-RADXA-001" > strings/0x409/serialnumber
+ echo "SteamFrame FPV" > strings/0x409/manufacturer
+ echo "Radxa VRX USB Ethernet" > strings/0x409/product
+
+ mkdir -p configs/c.1/strings/0x409
+ echo "CDC-ECM Ethernet" > configs/c.1/strings/0x409/configuration
+ echo 250 > configs/c.1/MaxPower
+
+ mkdir -p functions/ecm.usb0
+ # Bit 1 du 1er octet = 0 (MAC globale) : indispensable pour que cdc_ether sur Android nomme l'interface eth0
+ echo "00:1a:11:f0:00:02" > functions/ecm.usb0/host_addr
+ echo "00:1a:11:f0:00:01" > functions/ecm.usb0/dev_addr
+
+ ln -sf functions/ecm.usb0 configs/c.1/ecm.usb0
+ echo "${UDC_NAME}" > UDC
+ return 0
+}
+
+if ! setup_configfs_ecm; then
+ echo "[usb0-gadget] Fallback vers g_cdc" >&2
+ modprobe g_cdc || true
+fi
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 1b48f3a..a980d14 100644
--- a/src/video_usb.rs
+++ b/src/video_usb.rs
@@ -98,12 +98,16 @@ pub struct FrameMailbox {
ready_meta: Option,
spare_buf: Vec,
dmabuf_ready: Option,
+ /// Horodatage de la dernière trame publiée (conservé même après consommation par l'UI/VR
+ /// pour éviter les faux positifs "Signal vidéo perdu" entre deux trames).
+ last_received_at: Option,
}
impl FrameMailbox {
/// Publie un buffer rempli hors verrou en l'échangeant en O(1) contre `spare_buf`.
fn publish(&mut self, incoming: &mut Vec, meta: TakenFrameMeta) {
std::mem::swap(&mut self.ready_buf, incoming);
+ self.last_received_at = Some(meta.received_at);
self.ready_meta = Some(meta);
self.dmabuf_ready = None;
// Maintenir `incoming` prêt avec le tampon précédent réutilisable
@@ -114,6 +118,7 @@ impl FrameMailbox {
/// Publie une trame DMA-BUF zéro-copie (sans aucune copie pixel côté CPU).
fn publish_dmabuf(&mut self, dmabuf: DmaBufFrame) {
+ self.last_received_at = Some(dmabuf.received_at);
self.dmabuf_ready = Some(dmabuf);
}
@@ -123,10 +128,10 @@ impl FrameMailbox {
last_frame_id: u64,
max_age: Duration,
) -> (bool, Option) {
+ let is_live = self.is_live(max_age);
let Some(ref d) = self.dmabuf_ready else {
- return (false, None);
+ return (is_live, None);
};
- let is_live = d.received_at.elapsed() < max_age;
if !is_live || d.frame_id == last_frame_id {
return (is_live, None);
}
@@ -141,10 +146,10 @@ impl FrameMailbox {
last_frame_id: u64,
max_age: Duration,
) -> (bool, Option) {
+ let is_live = self.is_live(max_age);
let Some(meta) = self.ready_meta else {
- return (false, None);
+ return (is_live, None);
};
- let is_live = meta.received_at.elapsed() < max_age;
if !is_live || meta.frame_id == last_frame_id {
return (is_live, None);
}
@@ -154,12 +159,8 @@ impl FrameMailbox {
}
pub fn is_live(&self, max_age: Duration) -> bool {
- self.ready_meta
- .is_some_and(|m| m.received_at.elapsed() < max_age)
- || self
- .dmabuf_ready
- .as_ref()
- .is_some_and(|d| d.received_at.elapsed() < max_age)
+ self.last_received_at
+ .is_some_and(|t| t.elapsed() < max_age)
}
}
@@ -459,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 {
@@ -478,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",
)
}
}
@@ -509,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" };
@@ -1205,6 +1206,11 @@ mod tests {
assert_eq!(taken.unwrap().frame_id, 1);
assert_eq!(consumer.len(), 64);
assert_eq!(consumer[0], 42);
+ // Après consommation, le flux doit rester "live" tant que max_age n'est pas dépassé
+ assert!(mb.is_live(Duration::from_secs(1)));
+ let (live2, taken2) = mb.take_if_newer(&mut consumer, 1, Duration::from_secs(1));
+ assert!(live2);
+ assert!(taken2.is_none());
}
#[test]