Commit af260b5a authored by Max Kellermann's avatar Max Kellermann

output/{alsa,oss}: add assertions

parent 4efa96df
......@@ -802,6 +802,7 @@ alsa_play(struct audio_output *ao, const void *chunk, size_t size,
{
AlsaOutput *ad = (AlsaOutput *)ao;
assert(size > 0);
assert(size % ad->in_frame_size == 0);
if (ad->must_prepare) {
......@@ -819,6 +820,7 @@ alsa_play(struct audio_output *ao, const void *chunk, size_t size,
assert(size % ad->out_frame_size == 0);
size /= ad->out_frame_size;
assert(size > 0);
while (true) {
snd_pcm_sframes_t ret = ad->writei(ad->pcm, chunk, size);
......
......@@ -727,6 +727,8 @@ oss_output_play(struct audio_output *ao, const void *chunk, size_t size,
OssOutput *od = (OssOutput *)ao;
ssize_t ret;
assert(size > 0);
/* reopen the device since it was closed by dropBufferedAudio */
if (od->fd < 0 && !oss_reopen(od, error))
return 0;
......@@ -735,6 +737,8 @@ oss_output_play(struct audio_output *ao, const void *chunk, size_t size,
chunk = od->pcm_export->Export(chunk, size, size);
#endif
assert(size > 0);
while (true) {
ret = write(od->fd, chunk, size);
if (ret > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment