From: Kostya Shishkov Date: Fri, 5 Jan 2024 17:08:05 +0000 (+0100) Subject: core/soundcvt: fix some cases where resampler skipped its work X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=84082d37c8019fbac7009e4d09668eb04058dfb0;p=nihav.git core/soundcvt: fix some cases where resampler skipped its work --- 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()); }