aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Zander <riggs@FreeBSD.org>2021-11-01 14:16:36 +0000
committerThomas Zander <riggs@FreeBSD.org>2021-11-01 14:32:25 +0000
commitd2826bd49998da2256a61737dc7e8c00aa45b146 (patch)
tree49c8283b0c6a9d1760fc3f02a45b0b7778768842
parent4a115e6fe7b12d5916fe7fdc43589fb298756229 (diff)
downloadports-d2826bd49998da2256a61737dc7e8c00aa45b146.tar.gz
ports-d2826bd49998da2256a61737dc7e8c00aa45b146.zip
audio/openal-soft: Include the last patch for upstream sndio backend.
Details: - Backport the remaining sndio backend commit at: https://github.com/kcat/openal-soft/commit/2df78e49b1359e7603e3816270737c68cccd5b05 Reported by: Brad Smith <brad@comstyle.com> MFH: 2021Q4 (cherry picked from commit 520be1663a38864dc78882d186d423ba900a46ad)
-rw-r--r--audio/openal-soft/Makefile2
-rw-r--r--audio/openal-soft/files/patch-alc_backends_sndio.cpp22
2 files changed, 8 insertions, 16 deletions
diff --git a/audio/openal-soft/Makefile b/audio/openal-soft/Makefile
index 69987e4d8ffa..f780656de5ef 100644
--- a/audio/openal-soft/Makefile
+++ b/audio/openal-soft/Makefile
@@ -1,6 +1,6 @@
PORTNAME= openal-soft
PORTVERSION= 1.21.1
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= audio
MASTER_SITES= https://openal-soft.org/openal-releases/
diff --git a/audio/openal-soft/files/patch-alc_backends_sndio.cpp b/audio/openal-soft/files/patch-alc_backends_sndio.cpp
index dba1079c4249..ca168aebdff5 100644
--- a/audio/openal-soft/files/patch-alc_backends_sndio.cpp
+++ b/audio/openal-soft/files/patch-alc_backends_sndio.cpp
@@ -251,26 +251,18 @@
struct SndioCapture final : public BackendBase {
SndioCapture(ALCdevice *device) noexcept : BackendBase{device} { }
~SndioCapture() override;
-@@ -301,6 +283,7 @@ struct SndioCapture final : public BackendBase {
-
- sio_hdl *mSndHandle{nullptr};
-
-+ al::vector<struct pollfd> mFds;
- RingBufferPtr mRing;
-
- std::atomic<bool> mKillNow{true};
-@@ -323,40 +306,65 @@ int SndioCapture::recordProc()
+@@ -323,40 +305,65 @@ 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))
@@ -279,7 +271,7 @@
- size_t todo{data.first.len + data.second.len};
- if(todo == 0)
+ /* 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)
{
- static char junk[4096];
@@ -288,7 +280,7 @@
+ 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;
@@ -298,7 +290,7 @@
+ 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");
@@ -347,7 +339,7 @@
}
return 0;
-@@ -371,76 +379,80 @@ void SndioCapture::open(const char *name)
+@@ -371,76 +378,80 @@ void SndioCapture::open(const char *name)
throw al::backend_exception{al::backend_error::NoDevice, "Device name \"%s\" not found",
name};