From 827d24fde43ae448c5f2fe4c7d2e662b247b782c Mon Sep 17 00:00:00 2001 From: mofeng-git Date: Tue, 25 Aug 2026 14:58:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20Amlogic=20?= =?UTF-8?q?=E7=A1=AC=E4=BB=B6=E7=BC=96=E7=A0=81=E7=9A=84=E5=B9=B6=E8=A1=8C?= =?UTF-8?q?=E8=A7=A3=E7=A0=81=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/video/pipeline/encoder_state.rs | 13 +++++++++---- src/video/pipeline/shared.rs | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/video/pipeline/encoder_state.rs b/src/video/pipeline/encoder_state.rs index dafbdc53..02e9a032 100644 --- a/src/video/pipeline/encoder_state.rs +++ b/src/video/pipeline/encoder_state.rs @@ -231,9 +231,9 @@ fn create_mjpeg_decoder(resolution: Resolution) -> Result<(MjpegDecoderKind, Pix Ok((libyuv_mjpeg_decoder(resolution), PixelFormat::Nv12)) } -/// AMLENC 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. +/// Amlogic hardware encoders 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. pub(super) fn should_parallel_decode_mjpeg(config: &SharedVideoPipelineConfig) -> bool { if !config.input_format.is_compressed() || !matches!( @@ -248,7 +248,12 @@ pub(super) fn should_parallel_decode_mjpeg(config: &SharedVideoPipelineConfig) - Some(backend) => registry.encoder_with_backend(config.output_codec, backend), None => registry.best_available_encoder(config.output_codec), }; - selected.is_some_and(|encoder| encoder.backend == EncoderBackend::Amlogic) + selected.is_some_and(|encoder| { + matches!( + encoder.backend, + EncoderBackend::Amlogic | EncoderBackend::V4l2m2m + ) + }) } pub(super) fn build_encoder_state( diff --git a/src/video/pipeline/shared.rs b/src/video/pipeline/shared.rs index 81012293..8fb51921 100644 --- a/src/video/pipeline/shared.rs +++ b/src/video/pipeline/shared.rs @@ -636,7 +636,7 @@ impl SharedVideoPipeline { let mut encoder_config = config.clone(); if parallel_mjpeg_decode { encoder_config.input_format = PixelFormat::Nv12; - info!("Using capture-thread libyuv MJPEG decode with parallel AMLENC encoding"); + info!("Using capture-thread libyuv MJPEG decode with parallel hardware encoding"); } let mut encoder_state = build_encoder_state(&encoder_config)?; let _ = self.running.send(true);