mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
fix
This commit is contained in:
parent
c711683c63
commit
f032b8c798
2
Makefile
2
Makefile
@ -294,7 +294,7 @@ run-build-dev:
|
|||||||
--push
|
--push
|
||||||
|
|
||||||
run-build-release:
|
run-build-release:
|
||||||
$(DOCKER) buildx build -t registry.cn-hangzhou.aliyuncs.com/silentwind/kvmd -t silentwind0/kvmd:dev \
|
$(DOCKER) buildx build -t registry.cn-hangzhou.aliyuncs.com/silentwind/kvmd -t silentwind0/kvmd \
|
||||||
--progress plain \
|
--progress plain \
|
||||||
--platform linux/amd64,linux/arm64,linux/arm/v7 \
|
--platform linux/amd64,linux/arm64,linux/arm/v7 \
|
||||||
--build-arg CACHEBUST=$(date +%s) \
|
--build-arg CACHEBUST=$(date +%s) \
|
||||||
|
|||||||
@ -188,15 +188,10 @@ EOF
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 设置默认视频模式为 mjpeg
|
if [ ! -z "$H264PRESET" ]; then
|
||||||
if ! grep -q "mjpeg_default:" /etc/kvmd/override.yaml; then
|
if sed -i "s/ultrafast/$H264PRESET/g" /etc/kvmd/override.yaml; then
|
||||||
cat >> /etc/kvmd/override.yaml << EOF
|
log_info "H264 预设已设置为 $H264PRESET"
|
||||||
|
fi
|
||||||
streamer:
|
|
||||||
mjpeg_default: true # 首次访问默认使用 MJPEG 模式
|
|
||||||
h264_bitrate: 5000 # 默认码率 5000 Kbps
|
|
||||||
EOF
|
|
||||||
log_info "已设置首次访问默认使用 MJPEG 模式"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$VIDEOFORMAT" ]; then
|
if [ ! -z "$VIDEOFORMAT" ]; then
|
||||||
|
|||||||
@ -5,7 +5,3 @@ audio: {
|
|||||||
device = "hw:0"
|
device = "hw:0"
|
||||||
tc358743 = "/dev/video0"
|
tc358743 = "/dev/video0"
|
||||||
}
|
}
|
||||||
aplay: {
|
|
||||||
device = "plughw:UAC2Gadget,0"
|
|
||||||
check = "/run/kvmd/otg/uac2.usb0@meta.json"
|
|
||||||
}
|
|
||||||
@ -66,6 +66,7 @@ kvmd:
|
|||||||
- "--jpeg-sink-mode=0660"
|
- "--jpeg-sink-mode=0660"
|
||||||
- "--h264-bitrate={h264_bitrate}"
|
- "--h264-bitrate={h264_bitrate}"
|
||||||
- "--h264-gop={h264_gop}"
|
- "--h264-gop={h264_gop}"
|
||||||
|
- "--h264-preset=ultrafast"
|
||||||
- "--slowdown"
|
- "--slowdown"
|
||||||
gpio:
|
gpio:
|
||||||
drivers:
|
drivers:
|
||||||
|
|||||||
@ -260,7 +260,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="feature-disabled" id="stream-audio">
|
<tr class="feature-disabled" id="stream-audio">
|
||||||
<td>Audio volume:</td>
|
<td i18n="kvm_text19">Audio volume:</td>
|
||||||
<td class="value-slider">
|
<td class="value-slider">
|
||||||
<input class="slider" type="range" id="stream-audio-volume-slider">
|
<input class="slider" type="range" id="stream-audio-volume-slider">
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -68,7 +68,7 @@ li(id="system-dropdown" class="right")
|
|||||||
input(type="radio" id="stream-orient-radio-270" name="stream-orient-radio" value="270")
|
input(type="radio" id="stream-orient-radio-270" name="stream-orient-radio" value="270")
|
||||||
label(for="stream-orient-radio-270") 270°
|
label(for="stream-orient-radio-270") 270°
|
||||||
tr(id="stream-audio" class="feature-disabled")
|
tr(id="stream-audio" class="feature-disabled")
|
||||||
td Audio volume:
|
td(i18n="kvm_text19") Audio volume:
|
||||||
td(class="value-slider") #[input(type="range" id="stream-audio-volume-slider" class="slider")]
|
td(class="value-slider") #[input(type="range" id="stream-audio-volume-slider" class="slider")]
|
||||||
td(id="stream-audio-volume-value" class="value-number")
|
td(id="stream-audio-volume-value" class="value-number")
|
||||||
tr(id="stream-mic" class="feature-disabled")
|
tr(id="stream-mic" class="feature-disabled")
|
||||||
|
|||||||
@ -117,11 +117,6 @@ export function Streamer() {
|
|||||||
|
|
||||||
//hidden stream-record-stop-button
|
//hidden stream-record-stop-button
|
||||||
document.getElementById('stream-record-stop-button').disabled = true;
|
document.getElementById('stream-record-stop-button').disabled = true;
|
||||||
|
|
||||||
// 修改这里:设置默认模式为 mjpeg
|
|
||||||
let defaultMode = "mjpeg";
|
|
||||||
let mode = tools.storage.get("stream.mode", defaultMode);
|
|
||||||
tools.radio.clickValue("stream-mode-radio", mode);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
@ -230,7 +225,7 @@ export function Streamer() {
|
|||||||
tools.feature.setEnabled($("stream-mic"), false);
|
tools.feature.setEnabled($("stream-mic"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mode = tools.storage.get("stream.mode", "mjpeg"); // 这里也改为默认 mjpeg
|
let mode = tools.storage.get("stream.mode", "mjpeg");
|
||||||
if (mode === "janus" && !has_janus) {
|
if (mode === "janus" && !has_janus) {
|
||||||
mode = "media";
|
mode = "media";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
# KVMD - The main PiKVM daemon. #
|
# KVMD - The main PiKVM daemon. #
|
||||||
# #
|
# #
|
||||||
# Copyright (C) 2018-2024 Maxim Devaev <mdevaev@gmail.com> #
|
# Copyright (C) 2018-2024 Maxim Devaev <mdevaev@gmail.com> #
|
||||||
|
# Copyright (C) 2023-2025 SilentWind <mofeng654321@hotmail.com> #
|
||||||
# #
|
# #
|
||||||
# This program is free software: you can redistribute it and/or modify #
|
# This program is free software: you can redistribute it and/or modify #
|
||||||
# it under the terms of the GNU General Public License as published by #
|
# it under the terms of the GNU General Public License as published by #
|
||||||
@ -311,6 +312,50 @@ export function JanusStreamer(__setActive, __setInactive, __setInfo, __orient, _
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 添加对 Janus 0.x 的支持
|
||||||
|
"onremotestream": function(stream) {
|
||||||
|
if (stream === null) {
|
||||||
|
// https://github.com/pikvm/pikvm/issues/1084
|
||||||
|
// 这种情况不应该发生,但有时 Janus 在 unmute 时可能会收到 null 事件
|
||||||
|
// 作为解决方案,我们重启 Janus
|
||||||
|
__logError("Got invalid onremotestream(null). Restarting Janus...");
|
||||||
|
__destroyJanus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let tracks = stream.getTracks();
|
||||||
|
__logInfo("Got a remote stream changes:", stream, tracks);
|
||||||
|
|
||||||
|
let has_video = false;
|
||||||
|
for (let track of tracks) {
|
||||||
|
if (track.kind == "video") {
|
||||||
|
has_video = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!has_video && __isOnline()) {
|
||||||
|
// Chrome 在 ICE 状态为 disconnected 时会发送 muted 通知
|
||||||
|
// Janus.js 会从可用轨道列表中移除已静音的轨道
|
||||||
|
// 但轨道实际上仍然存在,所以可以安全地忽略这种情况
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_Janus.attachMediaStream($("stream-video"), stream);
|
||||||
|
__sendKeyRequired();
|
||||||
|
__startInfoInterval();
|
||||||
|
|
||||||
|
// FIXME: 延迟减少但在关键帧上会出现卡顿
|
||||||
|
// - https://github.com/Glimesh/janus-ftl-plugin/issues/101
|
||||||
|
/*if (__handle && __handle.webrtcStuff && __handle.webrtcStuff.pc) {
|
||||||
|
for (let receiver of __handle.webrtcStuff.pc.getReceivers()) {
|
||||||
|
if (receiver.track && receiver.track.kind === "video" && receiver.playoutDelayHint !== undefined) {
|
||||||
|
receiver.playoutDelayHint = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
},
|
||||||
|
|
||||||
"oncleanup": function() {
|
"oncleanup": function() {
|
||||||
__logInfo("Got a cleanup notification");
|
__logInfo("Got a cleanup notification");
|
||||||
__stopInfoInterval();
|
__stopInfoInterval();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user