mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-28 16:41:52 +08:00
- 调整音视频架构,提升 RKMPP 编码 MJPEG-->H264 性能,同时解决丢帧马赛克问题; - 删除多用户逻辑,只保留单用户,支持设置 web 单会话; - 修复删除体验不好的的回退逻辑,前端页面菜单位置微调; - 增加 OTG USB 设备动态调整功能; - 修复 mdns 问题,webrtc 视频切换更顺畅。
35 lines
1.1 KiB
Rust
35 lines
1.1 KiB
Rust
use webrtc::ice::mdns::MulticastDnsMode;
|
|
|
|
pub fn mdns_mode_from_env() -> Option<MulticastDnsMode> {
|
|
let raw = std::env::var("ONE_KVM_WEBRTC_MDNS_MODE").ok()?;
|
|
let value = raw.trim().to_ascii_lowercase();
|
|
if value.is_empty() {
|
|
return None;
|
|
}
|
|
|
|
match value.as_str() {
|
|
"disabled" | "off" | "false" | "0" => Some(MulticastDnsMode::Disabled),
|
|
"query" | "query_only" | "query-only" => Some(MulticastDnsMode::QueryOnly),
|
|
"gather" | "query_and_gather" | "query-and-gather" | "on" | "true" | "1" => {
|
|
Some(MulticastDnsMode::QueryAndGather)
|
|
}
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
pub fn mdns_mode() -> MulticastDnsMode {
|
|
mdns_mode_from_env().unwrap_or(MulticastDnsMode::QueryAndGather)
|
|
}
|
|
|
|
pub fn mdns_mode_label(mode: MulticastDnsMode) -> &'static str {
|
|
match mode {
|
|
MulticastDnsMode::Disabled => "disabled",
|
|
MulticastDnsMode::QueryOnly => "query_only",
|
|
MulticastDnsMode::QueryAndGather => "query_and_gather",
|
|
}
|
|
}
|
|
|
|
pub fn default_mdns_host_name(session_id: &str) -> String {
|
|
format!("{session_id}.local")
|
|
}
|