mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-06-14 11:42:02 +08:00
perf(video): 优化视频管道性能降低延迟
- 减少 broadcast channel 缓冲区大小以降低延迟 - 将 Mutex 字段改为原子类型减少锁竞争 - 使用本地计数器批量更新统计信息 - 修复 WebRTC 帧持续时间计算基于实际 FPS - 不再自动缩放码率,保留用户配置值
This commit is contained in:
@@ -533,16 +533,12 @@ impl WebRtcStreamer {
|
||||
info!("Closed {} existing sessions due to config change", session_count);
|
||||
}
|
||||
|
||||
// Update config
|
||||
// Update config (preserve user-configured bitrate)
|
||||
let mut config = self.config.write().await;
|
||||
config.resolution = resolution;
|
||||
config.input_format = format;
|
||||
config.fps = fps;
|
||||
|
||||
// Scale bitrate based on resolution
|
||||
let base_pixels: u64 = 1280 * 720;
|
||||
let actual_pixels: u64 = resolution.width as u64 * resolution.height as u64;
|
||||
config.bitrate_kbps = ((8000u64 * actual_pixels / base_pixels).max(1000).min(15000)) as u32;
|
||||
// Note: bitrate is NOT auto-scaled here - use set_bitrate() or config to change it
|
||||
|
||||
info!(
|
||||
"WebRTC config updated: {}x{} {:?} @ {} fps, {} kbps",
|
||||
|
||||
Reference in New Issue
Block a user