revert: remove non-ATX changes from #223 merge

This commit is contained in:
mofeng-git
2026-02-20 14:24:38 +08:00
parent 078c4e4ea1
commit 6e2c6dea1c
10 changed files with 67 additions and 87 deletions

View File

@@ -212,4 +212,4 @@
![林枫云](https://docs.one-kvm.cn/img/36076FEFF0898A80EBD5756D28F4076C.png) ![林枫云](https://docs.one-kvm.cn/img/36076FEFF0898A80EBD5756D28F4076C.png)
林枫云主营国内外地域的精品线路业务服务器、高主频游戏服务器和大带宽服务器。 林枫云主营国内外地域的精品线路业务服务器、高主频游戏服务器和大带宽服务器。

View File

@@ -19,22 +19,8 @@ ARCH_MAP=(
build_arch() { build_arch() {
local rust_target="$1" local rust_target="$1"
# Build frontend first echo "=== Building: $rust_target (via cross with custom Dockerfile) ==="
if [ ! -d "$PROJECT_DIR/web/dist" ]; then cross build --release --target "$rust_target"
echo "=== Building Frontend ==="
cd "$PROJECT_DIR/web" && npm install && npm run build
cd "$PROJECT_DIR"
fi
local host_arch=$(rustc -vV | grep host | cut -d ' ' -f 2)
if [ "$rust_target" == "$host_arch" ]; then
echo "=== Building: $rust_target (NATIVE build, skipping cross) ==="
cargo build --release --target "$rust_target"
else
echo "=== Building: $rust_target (via cross) ==="
cross build --release --target "$rust_target"
fi
} }
# Main # Main

View File

@@ -362,11 +362,10 @@ mod ffmpeg {
// RKMPP decode only exists on ARM builds where FFmpeg is compiled with RKMPP support. // RKMPP decode only exists on ARM builds where FFmpeg is compiled with RKMPP support.
// Avoid compiling this file on x86/x64 where `AV_HWDEVICE_TYPE_RKMPP` doesn't exist. // Avoid compiling this file on x86/x64 where `AV_HWDEVICE_TYPE_RKMPP` doesn't exist.
// Also check if RKMPP is available in the current FFmpeg environment to avoid compilation errors on non-Rockchip ARM (e.g. RPi).
let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default(); let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
let is_arm = matches!(target_arch.as_str(), "aarch64" | "arm"); let enable_rkmpp = matches!(target_arch.as_str(), "aarch64" | "arm")
|| std::env::var_os("CARGO_FEATURE_RKMPP").is_some();
if is_arm { if enable_rkmpp {
builder.file(ffmpeg_ram_dir.join("ffmpeg_ram_decode.cpp")); builder.file(ffmpeg_ram_dir.join("ffmpeg_ram_decode.cpp"));
} else { } else {
println!( println!(

View File

@@ -169,12 +169,12 @@ int linux_support_v4l2m2m() {
// /dev/video2 - Alternate path // /dev/video2 - Alternate path
// /dev/video32 - Some Allwinner/Rockchip legacy // /dev/video32 - Some Allwinner/Rockchip legacy
const char *m2m_devices[] = { const char *m2m_devices[] = {
"/dev/video10", "/dev/video10",
"/dev/video11", "/dev/video11",
"/dev/video0", "/dev/video0",
"/dev/video1", "/dev/video1",
"/dev/video2", "/dev/video2",
"/dev/video32", "/dev/video32",
}; };
for (size_t i = 0; i < sizeof(m2m_devices) / sizeof(m2m_devices[0]); i++) { for (size_t i = 0; i < sizeof(m2m_devices) / sizeof(m2m_devices[0]); i++) {

View File

@@ -10,19 +10,11 @@ extern "C" {
#include "common.h" #include "common.h"
#include "common.h"
#define LOG_MODULE "UTIL" #define LOG_MODULE "UTIL"
#include "log.h" #include "log.h"
#ifndef FF_PROFILE_H264_BASELINE
#define FF_PROFILE_H264_BASELINE 66
#endif
#ifndef FF_PROFILE_H264_HIGH
#define FF_PROFILE_H264_HIGH 100
#endif
#ifndef FF_PROFILE_HEVC_MAIN
#define FF_PROFILE_HEVC_MAIN 1
#endif
namespace { namespace {
// Helper function: check if encoder is software H264 (libx264) // Helper function: check if encoder is software H264 (libx264)

View File

@@ -55,11 +55,7 @@ public:
callback_ = callback; callback_ = callback;
if (name_.find("rkmpp") != std::string::npos) { if (name_.find("rkmpp") != std::string::npos) {
#ifdef AV_HWDEVICE_TYPE_RKMPP
hw_device_type_ = AV_HWDEVICE_TYPE_RKMPP; hw_device_type_ = AV_HWDEVICE_TYPE_RKMPP;
#else
set_last_error("RKMPP support not compiled in FFmpeg");
#endif
} }
} }

View File

@@ -354,43 +354,69 @@ impl Encoder {
let mut last_err: Option<i32> = None; let mut last_err: Option<i32> = None;
let is_v4l2m2m = codec.name.contains("v4l2m2m"); let is_v4l2m2m = codec.name.contains("v4l2m2m");
let max_attempts = if codec.name.contains("v4l2m2m") { let max_attempts = if is_v4l2m2m { 5 } else { 1 };
5
} else {
1
};
for attempt in 0..max_attempts { for attempt in 0..max_attempts {
encoder.request_keyframe(); if is_v4l2m2m {
encoder.request_keyframe();
}
let pts = (attempt as i64) * 33; // 33ms is an approximation for 30 FPS (1000 / 30) let pts = (attempt as i64) * 33; // 33ms is an approximation for 30 FPS (1000 / 30)
let start = std::time::Instant::now(); let start = std::time::Instant::now();
match encoder.encode(&yuv, pts) { match encoder.encode(&yuv, pts) {
Ok(frames) => { Ok(frames) => {
let elapsed = start.elapsed().as_millis(); let elapsed = start.elapsed().as_millis();
if frames.len() >= 1 && elapsed < TEST_TIMEOUT_MS as _ { if is_v4l2m2m {
if !frames.is_empty() && elapsed < TEST_TIMEOUT_MS as _ {
debug!(
"Encoder {} test passed on attempt {} (frames: {})",
codec.name,
attempt + 1,
frames.len()
);
res.push(codec.clone());
passed = true;
break;
} else if frames.is_empty() {
debug!(
"Encoder {} test produced no output on attempt {}",
codec.name,
attempt + 1
);
} else {
debug!(
"Encoder {} test failed on attempt {} - frames: {}, timeout: {}ms",
codec.name,
attempt + 1,
frames.len(),
elapsed
);
}
} else if frames.len() == 1 {
if frames[0].key == 1 && elapsed < TEST_TIMEOUT_MS as _ {
debug!(
"Encoder {} test passed on attempt {}",
codec.name,
attempt + 1
);
res.push(codec.clone());
passed = true;
break;
} else {
debug!(
"Encoder {} test failed on attempt {} - key: {}, timeout: {}ms",
codec.name,
attempt + 1,
frames[0].key,
elapsed
);
}
} else {
debug!( debug!(
"Encoder {} test passed on attempt {} (frames: {})", "Encoder {} test failed on attempt {} - wrong frame count: {}",
codec.name, codec.name,
attempt + 1, attempt + 1,
frames.len() frames.len()
); );
res.push(codec.clone());
passed = true;
break;
} else if frames.is_empty() {
debug!(
"Encoder {} test produced no output on attempt {}",
codec.name,
attempt + 1
);
} else {
debug!(
"Encoder {} test failed on attempt {} - frames: {}, timeout: {}ms",
codec.name,
attempt + 1,
frames.len(),
elapsed
);
} }
} }
Err(err) => { Err(err) => {

View File

@@ -3552,7 +3552,6 @@ pub async fn atx_power(
State(state): State<Arc<AppState>>, State(state): State<Arc<AppState>>,
Json(req): Json<AtxPowerControlRequest>, Json(req): Json<AtxPowerControlRequest>,
) -> Result<Json<LoginResponse>> { ) -> Result<Json<LoginResponse>> {
tracing::info!("Received ATX power request: action={}", req.action);
let atx_guard = state.atx.read().await; let atx_guard = state.atx.read().await;
let atx = atx_guard let atx = atx_guard
.as_ref() .as_ref()

View File

@@ -1407,19 +1407,15 @@ function openTerminalInNewTab() {
// ATX actions // ATX actions
async function handlePowerShort() { async function handlePowerShort() {
console.log('[ConsoleView] Handling power short press')
try { try {
const res = await atxApi.power('short') await atxApi.power('short')
console.log('[ConsoleView] Power short API result:', res)
await systemStore.fetchAtxState() await systemStore.fetchAtxState()
} catch (e) { } catch {
console.error('[ConsoleView] Power short API failed:', e)
// ATX action failed // ATX action failed
} }
} }
async function handlePowerLong() { async function handlePowerLong() {
console.log('[ConsoleView] Handling power long press')
try { try {
await atxApi.power('long') await atxApi.power('long')
await systemStore.fetchAtxState() await systemStore.fetchAtxState()

View File

@@ -372,11 +372,6 @@ onMounted(async () => {
} }
applyOtgProfileDefault() applyOtgProfileDefault()
// If no HID devices exist, default to disabled to avoid blocking setup
if (result.serial.length === 0 && result.udc.length === 0) {
hidBackend.value = 'none'
}
// Auto-select audio device if available (and no video device to trigger watch) // Auto-select audio device if available (and no video device to trigger watch)
if (result.audio.length > 0 && !audioDevice.value) { if (result.audio.length > 0 && !audioDevice.value) {
// Prefer HDMI audio device // Prefer HDMI audio device
@@ -392,10 +387,6 @@ onMounted(async () => {
// Use defaults // Use defaults
} }
if (devices.value.serial.length === 0 && devices.value.udc.length === 0) {
hidBackend.value = 'none'
}
// Load encoder backends // Load encoder backends
try { try {
const codecsResult = await streamApi.getCodecs() const codecsResult = await streamApi.getCodecs()
@@ -905,7 +896,6 @@ const stepIcons = [User, Video, Keyboard, Puzzle]
CH9329 ({{ t('setup.serialHid') }}) CH9329 ({{ t('setup.serialHid') }})
</SelectItem> </SelectItem>
<SelectItem value="otg">USB OTG</SelectItem> <SelectItem value="otg">USB OTG</SelectItem>
<SelectItem value="none">{{ t('setup.disableHid') }}</SelectItem>
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>
@@ -1014,10 +1004,6 @@ const stepIcons = [User, Video, Keyboard, Puzzle]
</div> </div>
</div> </div>
</div> </div>
<p v-if="hidBackend === 'none'" class="text-xs text-muted-foreground">
{{ t('setup.hidDisabledHint') }}
</p>
</div> </div>
<!-- Step 4: Extensions Settings --> <!-- Step 4: Extensions Settings -->