{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:
parent
81a97315e3
commit
76a1cae5d8
@ -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()
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user