aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/audio.c b/src/audio.c
index ca8b7b1d8..29e74bc44 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -293,6 +293,9 @@ static size_t audio_buffer_size(const struct audio_format *af)
static void audio_buffer_resize(size_t size)
{
+ assert(audio_buffer.position == 0);
+ assert((audio_buffer.size == 0) == (audio_buffer.buffer == NULL));
+
if (audio_buffer.size == size)
return;
@@ -352,6 +355,8 @@ int playAudio(const char *playChunk, size_t size)
send_size = audio_buffer.size - audio_buffer.position;
send_size = send_size < size ? send_size : size;
+ assert(send_size > 0);
+
memcpy(audio_buffer.buffer + audio_buffer.position, playChunk, send_size);
audio_buffer.position += send_size;
size -= send_size;