From 980f2ca56dbedb60aa3f880f66a97d151a107e62 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 23 Oct 2008 16:48:49 +0200 Subject: output_buffer: don't split frames Splitting a frame between two buffer chunks causes distortion in the output. MPD used to assume that the chunk size 1020 would never cause splitted frames, but that isn't the case for 24 bit stereo (127.5 frames), and even less for files with even more channels. --- src/pcm_utils.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/pcm_utils.c') diff --git a/src/pcm_utils.c b/src/pcm_utils.c index 5d315bdb3..bd7fc0482 100644 --- a/src/pcm_utils.c +++ b/src/pcm_utils.c @@ -560,6 +560,9 @@ size_t pcm_convert_size(const struct audio_format *inFormat, size_t src_size, const int shift = 2 * outFormat->channels; size_t dest_size = src_size; + /* no partial frames allowed */ + assert((src_size % audio_format_frame_size(inFormat)) == 0); + switch (inFormat->bits) { case 8: dest_size <<= 1; -- cgit v1.2.3