aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-10 11:46:54 +0200
committerMax Kellermann <max@duempel.org>2008-09-10 11:46:54 +0200
commit52ed06cbd82ef58ea273e51a05790f91303cb943 (patch)
tree11b786ab58f5a2dec9953b61a7c5874886f922f1 /src
parent688298e265af151ef0bb2a9d2f02055dce7cc1d6 (diff)
downloadmpd-52ed06cbd82ef58ea273e51a05790f91303cb943.tar.gz
mpd-52ed06cbd82ef58ea273e51a05790f91303cb943.tar.xz
mpd-52ed06cbd82ef58ea273e51a05790f91303cb943.zip
audio: added assertions
Diffstat (limited to '')
-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;