diff options
author | Max Kellermann <max@duempel.org> | 2013-11-22 22:50:29 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-11-22 23:27:56 +0100 |
commit | fc7d5b055d98306af0c882282902a23e963f026d (patch) | |
tree | be38c99eef3be2c4acfcbba4077842b7c17b738d /src/pcm/PcmResample.cxx | |
parent | 87c8953e8ed660b59ea2452b4d3a431785c47495 (diff) | |
download | mpd-fc7d5b055d98306af0c882282902a23e963f026d.tar.gz mpd-fc7d5b055d98306af0c882282902a23e963f026d.tar.xz mpd-fc7d5b055d98306af0c882282902a23e963f026d.zip |
PcmResampleLibsamplerate: clip 24 bit data
Using pcm_resample_lsr_32() for 24 bit samples works, but may cause 24
bit overflows. This commit makes 24 bit a special case with explicit
clipping.
Diffstat (limited to '')
-rw-r--r-- | src/pcm/PcmResample.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/pcm/PcmResample.cxx b/src/pcm/PcmResample.cxx index df37826ba..01f269ea9 100644 --- a/src/pcm/PcmResample.cxx +++ b/src/pcm/PcmResample.cxx @@ -155,8 +155,19 @@ PcmResampler::Resample24(unsigned channels, unsigned src_rate, unsigned dest_rate, size_t *dest_size_r, Error &error_r) { +#ifdef HAVE_LIBSAMPLERATE + if (pcm_resample_lsr_enabled()) + return pcm_resample_lsr_24(this, channels, + src_rate, src_buffer, src_size, + dest_rate, dest_size_r, + error_r); +#else + (void)error_r; +#endif + /* reuse the 32 bit code - the resampler code doesn't care if the upper 8 bits are actually used */ - return Resample32(channels, src_rate, src_buffer, src_size, - dest_rate, dest_size_r, error_r); + return pcm_resample_fallback_32(this, channels, + src_rate, src_buffer, src_size, + dest_rate, dest_size_r); } |