alsa/NonBlock: throw on snd_pcm_poll_descriptors_revents() error
This function is sparsely documented and a look at the bluez-alsa source code shows that implementations make undocumented assumptions on the `struct pollfd` array parameter which can lead to strange effects.
This commit is contained in:
parent
9c5790ab1d
commit
5cb603983e
@ -50,7 +50,7 @@ AlsaNonBlockPcm::PrepareSockets(MultiSocketMonitor &m, snd_pcm_t *pcm)
|
||||
|
||||
void
|
||||
AlsaNonBlockPcm::DispatchSockets(MultiSocketMonitor &m,
|
||||
snd_pcm_t *pcm) noexcept
|
||||
snd_pcm_t *pcm)
|
||||
{
|
||||
int count = snd_pcm_poll_descriptors_count(pcm);
|
||||
if (count <= 0)
|
||||
@ -69,7 +69,10 @@ AlsaNonBlockPcm::DispatchSockets(MultiSocketMonitor &m,
|
||||
});
|
||||
|
||||
unsigned short dummy;
|
||||
snd_pcm_poll_descriptors_revents(pcm, pfds, i - pfds, &dummy);
|
||||
int err = snd_pcm_poll_descriptors_revents(pcm, pfds, i - pfds, &dummy);
|
||||
if (err < 0)
|
||||
throw FormatRuntimeError("snd_pcm_poll_descriptors_revents() failed: %s",
|
||||
snd_strerror(-err));
|
||||
}
|
||||
|
||||
std::chrono::steady_clock::duration
|
||||
|
@ -45,8 +45,10 @@ public:
|
||||
/**
|
||||
* Wrapper for snd_pcm_poll_descriptors_revents(), to be
|
||||
* called from MultiSocketMonitor::DispatchSockets().
|
||||
*
|
||||
* Throws on error.
|
||||
*/
|
||||
void DispatchSockets(MultiSocketMonitor &m, snd_pcm_t *pcm) noexcept;
|
||||
void DispatchSockets(MultiSocketMonitor &m, snd_pcm_t *pcm);
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user