mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-03-20 09:56:41 +08:00
feat: 完善架构优化性能
- 调整音视频架构,提升 RKMPP 编码 MJPEG-->H264 性能,同时解决丢帧马赛克问题; - 删除多用户逻辑,只保留单用户,支持设置 web 单会话; - 修复删除体验不好的的回退逻辑,前端页面菜单位置微调; - 增加 OTG USB 设备动态调整功能; - 修复 mdns 问题,webrtc 视频切换更顺畅。
This commit is contained in:
@@ -32,6 +32,10 @@ function createVideoSession() {
|
||||
resolve: (ready: boolean) => void
|
||||
timer: ReturnType<typeof setTimeout>
|
||||
} | null = null
|
||||
let webrtcReadyAnyWaiter: {
|
||||
resolve: (ready: boolean) => void
|
||||
timer: ReturnType<typeof setTimeout>
|
||||
} | null = null
|
||||
|
||||
let modeReadyWaiter: {
|
||||
transitionId: string
|
||||
@@ -62,6 +66,11 @@ function createVideoSession() {
|
||||
webrtcReadyWaiter.resolve(false)
|
||||
webrtcReadyWaiter = null
|
||||
}
|
||||
if (webrtcReadyAnyWaiter) {
|
||||
clearTimeout(webrtcReadyAnyWaiter.timer)
|
||||
webrtcReadyAnyWaiter.resolve(false)
|
||||
webrtcReadyAnyWaiter = null
|
||||
}
|
||||
if (modeReadyWaiter) {
|
||||
clearTimeout(modeReadyWaiter.timer)
|
||||
modeReadyWaiter.resolve(null)
|
||||
@@ -104,6 +113,28 @@ function createVideoSession() {
|
||||
})
|
||||
}
|
||||
|
||||
function waitForWebRTCReadyAny(timeoutMs = 3000): Promise<boolean> {
|
||||
if (webrtcReadyAnyWaiter) {
|
||||
clearTimeout(webrtcReadyAnyWaiter.timer)
|
||||
webrtcReadyAnyWaiter.resolve(false)
|
||||
webrtcReadyAnyWaiter = null
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const timer = setTimeout(() => {
|
||||
if (webrtcReadyAnyWaiter) {
|
||||
webrtcReadyAnyWaiter = null
|
||||
}
|
||||
resolve(false)
|
||||
}, timeoutMs)
|
||||
|
||||
webrtcReadyAnyWaiter = {
|
||||
resolve,
|
||||
timer,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function waitForModeReady(transitionId: string, timeoutMs = 5000): Promise<string | null> {
|
||||
if (modeReadyWaiter) {
|
||||
clearTimeout(modeReadyWaiter.timer)
|
||||
@@ -156,6 +187,10 @@ function createVideoSession() {
|
||||
clearTimeout(webrtcReadyWaiter.timer)
|
||||
webrtcReadyWaiter.resolve(true)
|
||||
webrtcReadyWaiter = null
|
||||
} else if (!data.transition_id && webrtcReadyAnyWaiter) {
|
||||
clearTimeout(webrtcReadyAnyWaiter.timer)
|
||||
webrtcReadyAnyWaiter.resolve(true)
|
||||
webrtcReadyAnyWaiter = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +205,7 @@ function createVideoSession() {
|
||||
clearWaiters,
|
||||
registerTransition,
|
||||
waitForWebRTCReady,
|
||||
waitForWebRTCReadyAny,
|
||||
waitForModeReady,
|
||||
onModeSwitching,
|
||||
onModeReady,
|
||||
|
||||
Reference in New Issue
Block a user