mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-28 16:41:52 +08:00
fix(video): 修正默认码率配置并优化软件编码器
- 将默认码率从 8 Mbps 降至 1 Mbps,更适合嵌入式设备 - 修复 WebRtcConfig 中 max_bitrate < target_bitrate 的逻辑错误 - 优化 libx264/libx265 软件编码器的低延迟配置 - 优化 libvpx (VP8/VP9) 的实时编码参数
This commit is contained in:
@@ -375,7 +375,7 @@ impl Default for StreamConfig {
|
||||
Self {
|
||||
mode: StreamMode::Mjpeg,
|
||||
encoder: EncoderType::Auto,
|
||||
bitrate_kbps: 8000,
|
||||
bitrate_kbps: 1000,
|
||||
gop_size: 30,
|
||||
stun_server: Some("stun:stun.l.google.com:19302".to_string()),
|
||||
turn_server: None,
|
||||
|
||||
@@ -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(16); // Buffer up to 16 frames
|
||||
let (frame_tx, _) = broadcast::channel(64); // Buffer up to 64 frames for software encoding
|
||||
|
||||
Self {
|
||||
config,
|
||||
|
||||
@@ -126,7 +126,7 @@ impl Default for H264Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
base: EncoderConfig::default(),
|
||||
bitrate_kbps: 8000,
|
||||
bitrate_kbps: 1000,
|
||||
gop_size: 30,
|
||||
fps: 30,
|
||||
input_format: H264InputFormat::Nv12,
|
||||
|
||||
@@ -77,7 +77,7 @@ impl Default for SharedVideoPipelineConfig {
|
||||
resolution: Resolution::HD720,
|
||||
input_format: PixelFormat::Yuyv,
|
||||
output_codec: VideoEncoderType::H264,
|
||||
bitrate_kbps: 8000,
|
||||
bitrate_kbps: 1000,
|
||||
fps: 30,
|
||||
gop_size: 30,
|
||||
encoder_backend: None,
|
||||
@@ -311,7 +311,7 @@ impl SharedVideoPipeline {
|
||||
config.input_format
|
||||
);
|
||||
|
||||
let (frame_tx, _) = broadcast::channel(16);
|
||||
let (frame_tx, _) = broadcast::channel(64); // Increased from 16 for software encoding
|
||||
let (running_tx, running_rx) = watch::channel(false);
|
||||
let nv12_size = (config.resolution.width * config.resolution.height * 3 / 2) as usize;
|
||||
let yuv420p_size = nv12_size; // Same size as NV12
|
||||
|
||||
@@ -35,8 +35,8 @@ impl Default for WebRtcConfig {
|
||||
turn_servers: vec![],
|
||||
enable_datachannel: true,
|
||||
video_codec: VideoCodec::H264,
|
||||
target_bitrate_kbps: 8000,
|
||||
max_bitrate_kbps: 5000,
|
||||
target_bitrate_kbps: 1000,
|
||||
max_bitrate_kbps: 2000,
|
||||
min_bitrate_kbps: 500,
|
||||
enable_audio: true,
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ impl Default for UniversalSessionConfig {
|
||||
codec: VideoEncoderType::H264,
|
||||
resolution: Resolution::HD720,
|
||||
input_format: PixelFormat::Mjpeg,
|
||||
bitrate_kbps: 8000,
|
||||
bitrate_kbps: 1000,
|
||||
fps: 30,
|
||||
gop_size: 30,
|
||||
audio_enabled: false,
|
||||
|
||||
Reference in New Issue
Block a user