aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_format.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-10-19 21:56:41 +0200
committerMax Kellermann <max@duempel.org>2011-10-19 22:14:08 +0200
commitc4c44c4445a8c3ac148805d9c2ef61e2a6d8554a (patch)
tree93ed1812c0debe3432fad3b8cf7faea81a48f4dd /src/pcm_format.c
parent0debe9bd6ffb6f89a0756137837dcdc58fa84de0 (diff)
downloadmpd-c4c44c4445a8c3ac148805d9c2ef61e2a6d8554a.tar.gz
mpd-c4c44c4445a8c3ac148805d9c2ef61e2a6d8554a.tar.xz
mpd-c4c44c4445a8c3ac148805d9c2ef61e2a6d8554a.zip
pcm_{channels,format}: add alignment assertions
Diffstat (limited to 'src/pcm_format.c')
-rw-r--r--src/pcm_format.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pcm_format.c b/src/pcm_format.c
index 6e1e0906d..1d84fa77c 100644
--- a/src/pcm_format.c
+++ b/src/pcm_format.c
@@ -62,6 +62,8 @@ pcm_convert_to_16(struct pcm_buffer *buffer, struct pcm_dither *dither,
enum sample_format src_format, const void *src,
size_t src_size, size_t *dest_size_r)
{
+ assert(src_size % sample_format_size(src_format) == 0);
+
const void *src_end = pcm_end_pointer(src, src_size);
unsigned num_samples;
int16_t *dest;
@@ -157,6 +159,8 @@ pcm_convert_to_24(struct pcm_buffer *buffer,
enum sample_format src_format, const void *src,
size_t src_size, size_t *dest_size_r)
{
+ assert(src_size % sample_format_size(src_format) == 0);
+
unsigned num_samples;
int32_t *dest;
@@ -240,6 +244,8 @@ pcm_convert_to_32(struct pcm_buffer *buffer,
enum sample_format src_format, const void *src,
size_t src_size, size_t *dest_size_r)
{
+ assert(src_size % sample_format_size(src_format) == 0);
+
unsigned num_samples;
int32_t *dest;