aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/pcm_channels.c6
-rw-r--r--src/pcm_format.c6
2 files changed, 12 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);
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;