audio: added assertions
This commit is contained in:
parent
688298e265
commit
52ed06cbd8
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user