From 84082d37c8019fbac7009e4d09668eb04058dfb0 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 5 Jan 2024 18:08:05 +0100 Subject: [PATCH] core/soundcvt: fix some cases where resampler skipped its work --- nihav-core/src/soundcvt/resample.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nihav-core/src/soundcvt/resample.rs b/nihav-core/src/soundcvt/resample.rs index 9c612f9..dc2f178 100644 --- a/nihav-core/src/soundcvt/resample.rs +++ b/nihav-core/src/soundcvt/resample.rs @@ -262,9 +262,14 @@ impl NAResample { let src_fmt = src_info.get_format(); let dst_fmt = self.dst_info.get_format(); - let no_conversion = src_fmt == dst_fmt; + let mut no_conversion = src_fmt == dst_fmt; - if no_conversion && no_channel_needs { + // packed PCM needs to be processed + if no_conversion && matches!(src, NABufferType::AudioPacked(_)) && !src_fmt.is_packed() && ((src_fmt.bits % 8) == 0) { + no_conversion = false; + } + + if no_conversion && no_channel_needs && !needs_resample { return Ok(src.clone()); } -- 2.39.5