mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-06-16 23:11:51 +08:00
fix: 优化视频切换流畅性;修复 OTG HID 功能无法一次保存成功和页面未即刻生效问题
This commit is contained in:
@@ -787,6 +787,22 @@ impl WebRtcStreamer {
|
||||
count
|
||||
}
|
||||
|
||||
/// Close all sessions and wait for the video pipeline to fully release the
|
||||
/// capture device. Use this when the caller needs the V4L2 device immediately
|
||||
/// afterwards (e.g. switching to MJPEG mode).
|
||||
pub async fn close_all_sessions_and_release_device(&self) -> usize {
|
||||
let count = self.close_all_sessions().await;
|
||||
|
||||
if let Some(ref pipeline) = *self.video_pipeline.read().await {
|
||||
pipeline
|
||||
.stop_and_wait(std::time::Duration::from_secs(3))
|
||||
.await;
|
||||
}
|
||||
*self.video_pipeline.write().await = None;
|
||||
|
||||
count
|
||||
}
|
||||
|
||||
/// Get session count
|
||||
pub async fn session_count(&self) -> usize {
|
||||
self.sessions.read().await.len()
|
||||
|
||||
Reference in New Issue
Block a user