feat: 深入适配 RK628D CSI 采集卡的设备识别、参数读取、自恢复和音频采集

This commit is contained in:
mofeng-git
2026-04-19 11:26:21 +08:00
parent 8eac31f69f
commit 7c703b8b4b
39 changed files with 3261 additions and 769 deletions

View File

@@ -78,15 +78,13 @@ async fn handle_audio_socket(socket: WebSocket, state: Arc<AppState>) {
loop {
tokio::select! {
// Receive Opus frames and send to client
opus_result = opus_rx.changed() => {
if opus_result.is_err() {
info!("Audio stream closed");
break;
}
let frame = match opus_rx.borrow().clone() {
Some(frame) => frame,
None => continue,
opus_result = opus_rx.recv() => {
let frame = match opus_result {
Some(f) => f,
None => {
info!("Audio stream closed");
break;
}
};
let binary = encode_audio_packet(&frame, stream_start);

View File

@@ -988,6 +988,7 @@ pub struct VideoDevice {
pub driver: String,
pub formats: Vec<VideoFormat>,
pub usb_bus: Option<String>,
pub has_signal: bool,
}
#[derive(Serialize)]
@@ -1083,10 +1084,14 @@ pub async fn list_devices(State(state): State<Arc<AppState>>) -> Json<DeviceList
})
.collect(),
usb_bus,
has_signal: d.has_signal,
}
})
.collect(),
Err(_) => vec![],
Err(e) => {
warn!(error = %e, "Video device enumeration failed; returning empty video list for /api/devices");
vec![]
}
};
// Detect serial devices (common USB/ACM ports) - single directory read