fixed URI Stream sharing

This commit is contained in:
2026-05-07 04:35:52 -03:00
parent 3fc54a1fb5
commit 0ebd192487
2 changed files with 22 additions and 3 deletions

View File

@@ -265,13 +265,31 @@ pub(crate) fn video_stream_information_packet(
msg.extend_from_slice(&720u16.to_le_bytes()); msg.extend_from_slice(&720u16.to_le_bytes());
msg.extend_from_slice(&0u16.to_le_bytes()); msg.extend_from_slice(&0u16.to_le_bytes());
msg.extend_from_slice(&(hfov_deg.clamp(1.0, 360.0).round() as u16).to_le_bytes()); msg.extend_from_slice(&(hfov_deg.clamp(1.0, 360.0).round() as u16).to_le_bytes());
msg.push(0); msg.push(1);
msg.push(1); msg.push(1);
msg.push(stream_type); msg.push(stream_type);
msg.extend_from_slice(&name); msg.extend_from_slice(&name);
msg.extend_from_slice(&uri); msg.extend_from_slice(&uri);
msg.push(VIDEO_STREAM_ENCODING_H264); msg.push(VIDEO_STREAM_ENCODING_H264);
msg.push(CAMERA_COMPONENT_ID); msg.push(0);
build_v2_packet(system_id, CAMERA_COMPONENT_ID, 269, &msg, 109) build_v2_packet(system_id, CAMERA_COMPONENT_ID, 269, &msg, 109)
} }
pub(crate) fn video_stream_status_packet(
system_id: u8,
hfov_deg: f32,
) -> Vec<u8> {
let mut msg = Vec::with_capacity(19);
msg.extend_from_slice(&30f32.to_le_bytes());
msg.extend_from_slice(&4_000_000u32.to_le_bytes());
msg.extend_from_slice(&VIDEO_STREAM_STATUS_FLAGS_RUNNING.to_le_bytes());
msg.extend_from_slice(&1280u16.to_le_bytes());
msg.extend_from_slice(&720u16.to_le_bytes());
msg.extend_from_slice(&0u16.to_le_bytes());
msg.extend_from_slice(&(hfov_deg.clamp(1.0, 360.0).round() as u16).to_le_bytes());
msg.push(1);
msg.push(0);
build_v2_packet(system_id, CAMERA_COMPONENT_ID, 270, &msg, 59)
}

View File

@@ -9,7 +9,7 @@ use super::packets::{
attitude_packet, autopilot_version_packet, camera_information_packet, attitude_packet, autopilot_version_packet, camera_information_packet,
component_heartbeat_packet, extended_sys_state_packet, global_position_int_packet, component_heartbeat_packet, extended_sys_state_packet, global_position_int_packet,
gps_raw_int_packet, heartbeat_packet, system_status_packet, vfr_hud_packet, gps_raw_int_packet, heartbeat_packet, system_status_packet, vfr_hud_packet,
video_stream_information_packet, video_stream_information_packet, video_stream_status_packet,
}; };
use super::payload::{UasSystemPayload, UasTelemetryPayload}; use super::payload::{UasSystemPayload, UasTelemetryPayload};
@@ -136,6 +136,7 @@ pub fn send_uas_system(ctx: Context, payload: UasSystemPayload) -> &'static str
&payload.video_uri, &payload.video_uri,
payload.hfov_deg, payload.hfov_deg,
)); ));
packets.push(video_stream_status_packet(system_id, payload.hfov_deg));
} else if !payload.video_uri.trim().is_empty() { } else if !payload.video_uri.trim().is_empty() {
info!( info!(
"Skipping VIDEO_STREAM_INFORMATION for sysid={} because URI is not a supported stream URI: {}", "Skipping VIDEO_STREAM_INFORMATION for sysid={} because URI is not a supported stream URI: {}",