diff options
author | Max Kellermann <max@duempel.org> | 2011-10-19 21:56:41 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-10-19 22:14:08 +0200 |
commit | c4c44c4445a8c3ac148805d9c2ef61e2a6d8554a (patch) | |
tree | 93ed1812c0debe3432fad3b8cf7faea81a48f4dd /src/pcm_channels.c | |
parent | 0debe9bd6ffb6f89a0756137837dcdc58fa84de0 (diff) | |
download | mpd-c4c44c4445a8c3ac148805d9c2ef61e2a6d8554a.tar.gz mpd-c4c44c4445a8c3ac148805d9c2ef61e2a6d8554a.tar.xz mpd-c4c44c4445a8c3ac148805d9c2ef61e2a6d8554a.zip |
pcm_{channels,format}: add alignment assertions
Diffstat (limited to 'src/pcm_channels.c')
-rw-r--r-- | src/pcm_channels.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pcm_channels.c b/src/pcm_channels.c index 05a65a62a..5e648f1ae 100644 --- a/src/pcm_channels.c +++ b/src/pcm_channels.c @@ -75,6 +75,8 @@ pcm_convert_channels_16(struct pcm_buffer *buffer, uint8_t src_channels, const int16_t *src, size_t src_size, size_t *dest_size_r) { + assert(src_size % (sizeof(*src) * src_channels) == 0); + unsigned num_frames = src_size / src_channels / sizeof(*src); unsigned dest_size = num_frames * dest_channels * sizeof(*src); int16_t *dest = pcm_buffer_get(buffer, dest_size); @@ -146,6 +148,8 @@ pcm_convert_channels_24(struct pcm_buffer *buffer, uint8_t src_channels, const int32_t *src, size_t src_size, size_t *dest_size_r) { + assert(src_size % (sizeof(*src) * src_channels) == 0); + unsigned num_frames = src_size / src_channels / sizeof(*src); unsigned dest_size = num_frames * dest_channels * sizeof(*src); int32_t *dest = pcm_buffer_get(buffer, dest_size); @@ -212,6 +216,8 @@ pcm_convert_channels_32(struct pcm_buffer *buffer, uint8_t src_channels, const int32_t *src, size_t src_size, size_t *dest_size_r) { + assert(src_size % (sizeof(*src) * src_channels) == 0); + unsigned num_frames = src_size / src_channels / sizeof(*src); unsigned dest_size = num_frames * dest_channels * sizeof(*src); int32_t *dest = pcm_buffer_get(buffer, dest_size); |