Commit 76a1cae5 authored by Max Kellermann's avatar Max Kellermann

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

Doesn't make a practical difference - but it's more correct this way.
parent 81a97315
...@@ -181,7 +181,7 @@ AlsaInputStream::PrepareSockets() ...@@ -181,7 +181,7 @@ AlsaInputStream::PrepareSockets()
} }
int count = snd_pcm_poll_descriptors_count(capture_handle); int count = snd_pcm_poll_descriptors_count(capture_handle);
if (count < 0) { if (count <= 0) {
ClearSocketList(); ClearSocketList();
return std::chrono::steady_clock::duration(-1); return std::chrono::steady_clock::duration(-1);
} }
......
...@@ -102,7 +102,7 @@ AlsaMixerMonitor::PrepareSockets() ...@@ -102,7 +102,7 @@ AlsaMixerMonitor::PrepareSockets()
} }
int count = snd_mixer_poll_descriptors_count(mixer); int count = snd_mixer_poll_descriptors_count(mixer);
if (count < 0) if (count <= 0)
count = 0; count = 0;
struct pollfd *pfds = pfd_buffer.Get(count); struct pollfd *pfds = pfd_buffer.Get(count);
......
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