{input,mixer}/alsa: fix off-by-one bug in count check

Doesn't make a practical difference - but it's more correct this way.
This commit is contained in:
Max Kellermann 2017-02-08 17:04:46 +01:00
parent 81a97315e3
commit 76a1cae5d8
2 changed files with 2 additions and 2 deletions

View File

@ -181,7 +181,7 @@ AlsaInputStream::PrepareSockets()
}
int count = snd_pcm_poll_descriptors_count(capture_handle);
if (count < 0) {
if (count <= 0) {
ClearSocketList();
return std::chrono::steady_clock::duration(-1);
}

View File

@ -102,7 +102,7 @@ AlsaMixerMonitor::PrepareSockets()
}
int count = snd_mixer_poll_descriptors_count(mixer);
if (count < 0)
if (count <= 0)
count = 0;
struct pollfd *pfds = pfd_buffer.Get(count);