mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-09-12 18:44:25 +08:00
feat: 增加 Amlogic 硬件编码的并行解码支持
This commit is contained in:
@@ -231,9 +231,9 @@ fn create_mjpeg_decoder(resolution: Resolution) -> Result<(MjpegDecoderKind, Pix
|
|||||||
Ok((libyuv_mjpeg_decoder(resolution), PixelFormat::Nv12))
|
Ok((libyuv_mjpeg_decoder(resolution), PixelFormat::Nv12))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// AMLENC and libjpeg-turbo use independent CPU/hardware resources. Decode
|
/// Amlogic hardware encoders and libjpeg-turbo use independent CPU/hardware
|
||||||
/// MJPEG in the capture worker so encoding the previous NV12 frame can overlap
|
/// resources. Decode MJPEG in the capture worker so encoding the previous NV12
|
||||||
/// with decoding the next frame.
|
/// frame can overlap with decoding the next frame.
|
||||||
pub(super) fn should_parallel_decode_mjpeg(config: &SharedVideoPipelineConfig) -> bool {
|
pub(super) fn should_parallel_decode_mjpeg(config: &SharedVideoPipelineConfig) -> bool {
|
||||||
if !config.input_format.is_compressed()
|
if !config.input_format.is_compressed()
|
||||||
|| !matches!(
|
|| !matches!(
|
||||||
@@ -248,7 +248,12 @@ pub(super) fn should_parallel_decode_mjpeg(config: &SharedVideoPipelineConfig) -
|
|||||||
Some(backend) => registry.encoder_with_backend(config.output_codec, backend),
|
Some(backend) => registry.encoder_with_backend(config.output_codec, backend),
|
||||||
None => registry.best_available_encoder(config.output_codec),
|
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(
|
pub(super) fn build_encoder_state(
|
||||||
|
|||||||
@@ -636,7 +636,7 @@ impl SharedVideoPipeline {
|
|||||||
let mut encoder_config = config.clone();
|
let mut encoder_config = config.clone();
|
||||||
if parallel_mjpeg_decode {
|
if parallel_mjpeg_decode {
|
||||||
encoder_config.input_format = PixelFormat::Nv12;
|
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 mut encoder_state = build_encoder_state(&encoder_config)?;
|
||||||
let _ = self.running.send(true);
|
let _ = self.running.send(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user