aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-09-01 20:10:30 -0700
committerChris Robinson <[email protected]>2021-09-01 20:10:30 -0700
commit2df78e49b1359e7603e3816270737c68cccd5b05 (patch)
tree076ee962b57e20698926a5bfe9530a195d1cbd29 /alc/backends
parentd97ff8f1c41cb371a873c22be2df3c577cca228a (diff)
Use a local unique_ptr array instead of a struct member
For the sndio poll fds.
Diffstat (limited to 'alc/backends')
-rw-r--r--alc/backends/sndio.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/alc/backends/sndio.cpp b/alc/backends/sndio.cpp
index 2c3eb3c7..469e5c85 100644
--- a/alc/backends/sndio.cpp
+++ b/alc/backends/sndio.cpp
@@ -288,7 +288,6 @@ struct SndioCapture final : public BackendBase {
sio_hdl *mSndHandle{nullptr};
- al::vector<struct pollfd> mFds;
RingBufferPtr mRing;
std::atomic<bool> mKillNow{true};
@@ -312,25 +311,25 @@ int SndioCapture::recordProc()
const uint frameSize{mDevice->frameSizeFromFmt()};
int nfds_pre{sio_nfds(mSndHandle)};
- if (nfds_pre <= 0)
+ if(nfds_pre <= 0)
{
mDevice->handleDisconnect("Incorrect return value from sio_nfds(): %d", nfds_pre);
return 1;
}
- mFds.resize(nfds_pre);
+ auto fds = std::make_unique<pollfd[]>(static_cast<uint>(nfds_pre));
while(!mKillNow.load(std::memory_order_acquire)
&& mDevice->Connected.load(std::memory_order_acquire))
{
/* Wait until there's some samples to read. */
- const int nfds{sio_pollfd(mSndHandle, mFds.data(), POLLIN)};
+ const int nfds{sio_pollfd(mSndHandle, fds.get(), POLLIN)};
if(nfds <= 0)
{
mDevice->handleDisconnect("Failed to get polling fds: %d", nfds);
break;
}
- int pollres{::poll(mFds.data(), static_cast<uint>(nfds), 2000)};
+ int pollres{::poll(fds.get(), static_cast<uint>(nfds), 2000)};
if(pollres < 0)
{
if(errno == EINTR) continue;
@@ -340,7 +339,7 @@ int SndioCapture::recordProc()
if(pollres == 0)
continue;
- const int revents{sio_revents(mSndHandle, mFds.data())};
+ const int revents{sio_revents(mSndHandle, fds.get())};
if((revents&POLLHUP))
{
mDevice->handleDisconnect("Got POLLHUP from poll events");