perf(video): 并行解码 MJPEG 并丢弃积压帧

按可用 CPU 数量启动独立 MJPEG 解码线程,通过无缓冲通道分发任务;线程全忙时丢弃新帧,按序列号拒绝过时解码结果。

复用帧缓冲池,在线程启动失败时回退到采集线程解码,并更新并行解码说明及工作线程数量测试。
This commit is contained in:
mofeng-git
2026-09-05 14:10:53 +08:00
parent 79a4dcf2b0
commit 620fe0be54
2 changed files with 143 additions and 5 deletions

View File

@@ -190,8 +190,8 @@ fn create_mjpeg_decoder(resolution: Resolution) -> Result<(MjpegDecoderKind, Pix
}
/// V4L2 M2M hardware encoding and libjpeg-turbo use independent CPU/hardware
/// resources. Decode MJPEG in the capture worker so encoding the previous NV12
/// frame can overlap with decoding the next frame.
/// resources. Decode MJPEG outside the encoder worker so encoding the previous
/// NV12 frame can overlap with decoding subsequent frames.
pub(super) fn should_parallel_decode_mjpeg(config: &SharedVideoPipelineConfig) -> bool {
if !config.input_format.is_compressed()
|| !matches!(