mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-06-14 03:32:00 +08:00
feat: 深入适配 RK628D CSI 采集卡的设备识别、参数读取、自恢复和音频采集
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user