feat: 支持硬件编码能力测试,otg 自检修改为需要手动执行

This commit is contained in:
mofeng-git
2026-03-22 14:55:44 +08:00
parent c119db4908
commit 24a10aa222
8 changed files with 545 additions and 5 deletions

View File

@@ -16,7 +16,10 @@ use crate::events::SystemEvent;
use crate::state::AppState;
use crate::update::{UpdateChannel, UpdateOverviewResponse, UpdateStatusResponse, UpgradeRequest};
use crate::video::codec_constraints::codec_to_id;
use crate::video::encoder::BitratePreset;
use crate::video::encoder::{
build_hardware_self_check_runtime_error, run_hardware_self_check, BitratePreset,
VideoEncoderSelfCheckResponse,
};
// ============================================================================
// Health & Info
@@ -1848,6 +1851,15 @@ pub async fn stream_codecs_list() -> Json<AvailableCodecsResponse> {
})
}
/// Run hardware encoder smoke tests across common resolutions/codecs.
pub async fn video_encoder_self_check() -> Json<VideoEncoderSelfCheckResponse> {
let response = tokio::task::spawn_blocking(run_hardware_self_check)
.await
.unwrap_or_else(|_| build_hardware_self_check_runtime_error());
Json(response)
}
/// Query parameters for MJPEG stream
#[derive(Deserialize, Default)]
pub struct MjpegStreamQuery {