diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/pcm_resample_fallback.c | 6 |
2 files changed, 5 insertions, 2 deletions
@@ -13,6 +13,7 @@ MPD 0.14.1 - not yet released - honour http_proxy_* config directives - fix assertion failure on "connection refused" - fix assertion failure with empty HTTP responses +* corrected the sample calculation in the fallback resampler * log: automatically append newline * fix setenv() conflict on Solaris * configure.ac: check for pkg-config before using it diff --git a/src/pcm_resample_fallback.c b/src/pcm_resample_fallback.c index a55efb824..cd0f9a799 100644 --- a/src/pcm_resample_fallback.c +++ b/src/pcm_resample_fallback.c @@ -32,7 +32,8 @@ pcm_resample_16(uint8_t channels, G_GNUC_UNUSED struct pcm_resample_state *state) { unsigned src_pos, dest_pos = 0; - unsigned dest_samples = dest_size / sizeof(*dest_buffer); + unsigned dest_frames = dest_size / channels / sizeof(*dest_buffer); + unsigned dest_samples = dest_frames * channels; assert((src_size % (sizeof(*src_buffer) * channels)) == 0); assert((dest_size % (sizeof(*dest_buffer) * channels)) == 0); @@ -68,7 +69,8 @@ pcm_resample_24(uint8_t channels, G_GNUC_UNUSED struct pcm_resample_state *state) { unsigned src_pos, dest_pos = 0; - unsigned dest_samples = dest_size / sizeof(*dest_buffer); + unsigned dest_frames = dest_size / channels / sizeof(*dest_buffer); + unsigned dest_samples = dest_frames * channels; switch (channels) { case 1: |