aboutsummaryrefslogtreecommitdiffstats
path: root/nihav-core/src/soundcvt/resample.rs
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2024-01-05 18:08:05 +0100
committerKostya Shishkov <kostya.shishkov@gmail.com>2024-01-05 18:08:05 +0100
commit84082d37c8019fbac7009e4d09668eb04058dfb0 (patch)
tree0492fc941e60378891b3bae360a4fe2bd4b748f8 /nihav-core/src/soundcvt/resample.rs
parent769b447349aa83a606b6e8ccd8c8b7f13eb2f63c (diff)
downloadnihav-84082d37c8019fbac7009e4d09668eb04058dfb0.tar.gz
core/soundcvt: fix some cases where resampler skipped its work
Diffstat (limited to 'nihav-core/src/soundcvt/resample.rs')
-rw-r--r--nihav-core/src/soundcvt/resample.rs9
1 files 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());
}