perf(video): 优化视频管道性能降低延迟

- 减少 broadcast channel 缓冲区大小以降低延迟
- 将 Mutex 字段改为原子类型减少锁竞争
- 使用本地计数器批量更新统计信息
- 修复 WebRTC 帧持续时间计算基于实际 FPS
- 不再自动缩放码率,保留用户配置值
This commit is contained in:
mofeng-git
2026-01-01 13:31:51 +08:00
parent 6740c41188
commit 13516d5cbd
4 changed files with 55 additions and 54 deletions

View File

@@ -143,7 +143,7 @@ impl VideoCapturer {
/// Create a new video capturer
pub fn new(config: CaptureConfig) -> Self {
let (state_tx, state_rx) = watch::channel(CaptureState::Stopped);
let (frame_tx, _) = broadcast::channel(64); // Buffer up to 64 frames for software encoding
let (frame_tx, _) = broadcast::channel(4); // Reduced from 64 for lower latency
Self {
config,