aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/pulseaudio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alc/backends/pulseaudio.cpp')
-rw-r--r--alc/backends/pulseaudio.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index 3862ec2e..7f8a8fb3 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -687,8 +687,8 @@ void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) noexce
do {
pa_free_cb_t free_func{nullptr};
auto buflen = static_cast<size_t>(-1);
- void *buf;
- if UNLIKELY(pa_stream_begin_write(stream, &buf, &buflen) || !buf)
+ void *buf{};
+ if(pa_stream_begin_write(stream, &buf, &buflen) || !buf) [[alunlikely]]
{
buflen = nbytes;
buf = pa_xmalloc(buflen);
@@ -701,7 +701,7 @@ void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) noexce
mDevice->renderSamples(buf, static_cast<uint>(buflen/mFrameSize), mSpec.channels);
int ret{pa_stream_write(stream, buf, buflen, free_func, 0, PA_SEEK_RELATIVE)};
- if UNLIKELY(ret != PA_OK)
+ if(ret != PA_OK) [[alunlikely]]
ERR("Failed to write to stream: %d, %s\n", ret, pa_strerror(ret));
} while(nbytes > 0);
}
@@ -1046,7 +1046,7 @@ ClockLatency PulsePlayback::getClockLatency()
err = pa_stream_get_latency(mStream, &latency, &neg);
}
- if UNLIKELY(err != 0)
+ if(err != 0) [[alunlikely]]
{
/* If err = -PA_ERR_NODATA, it means we were called too soon after
* starting the stream and no timing info has been received from the
@@ -1057,7 +1057,7 @@ ClockLatency PulsePlayback::getClockLatency()
latency = mDevice->BufferSize - mDevice->UpdateSize;
neg = 0;
}
- else if UNLIKELY(neg)
+ else if(neg) [[alunlikely]]
latency = 0;
ret.Latency = std::chrono::microseconds{latency};
@@ -1284,7 +1284,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples)
if(!mCapBuffer.empty())
{
const size_t rem{minz(dstbuf.size(), mCapBuffer.size())};
- if UNLIKELY(mCapLen < 0)
+ if(mCapLen < 0) [[alunlikely]]
std::fill_n(dstbuf.begin(), rem, mSilentVal);
else
std::copy_n(mCapBuffer.begin(), rem, dstbuf.begin());
@@ -1294,7 +1294,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples)
continue;
}
- if UNLIKELY(!mDevice->Connected.load(std::memory_order_acquire))
+ if(!mDevice->Connected.load(std::memory_order_acquire)) [[alunlikely]]
break;
MainloopUniqueLock plock{mMainloop};
@@ -1305,14 +1305,14 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples)
mCapLen = 0;
}
const pa_stream_state_t state{pa_stream_get_state(mStream)};
- if UNLIKELY(!PA_STREAM_IS_GOOD(state))
+ if(!PA_STREAM_IS_GOOD(state)) [[alunlikely]]
{
mDevice->handleDisconnect("Bad capture state: %u", state);
break;
}
const void *capbuf;
size_t caplen;
- if UNLIKELY(pa_stream_peek(mStream, &capbuf, &caplen) < 0)
+ if(pa_stream_peek(mStream, &capbuf, &caplen) < 0) [[alunlikely]]
{
mDevice->handleDisconnect("Failed retrieving capture samples: %s",
pa_strerror(pa_context_errno(mContext)));
@@ -1321,7 +1321,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples)
plock.unlock();
if(caplen == 0) break;
- if UNLIKELY(!capbuf)
+ if(!capbuf) [[alunlikely]]
mCapLen = -static_cast<ssize_t>(caplen);
else
mCapLen = static_cast<ssize_t>(caplen);
@@ -1339,7 +1339,7 @@ uint PulseCapture::availableSamples()
{
MainloopUniqueLock plock{mMainloop};
size_t got{pa_stream_readable_size(mStream)};
- if UNLIKELY(static_cast<ssize_t>(got) < 0)
+ if(static_cast<ssize_t>(got) < 0) [[alunlikely]]
{
const char *err{pa_strerror(static_cast<int>(got))};
ERR("pa_stream_readable_size() failed: %s\n", err);
@@ -1370,13 +1370,13 @@ ClockLatency PulseCapture::getClockLatency()
err = pa_stream_get_latency(mStream, &latency, &neg);
}
- if UNLIKELY(err != 0)
+ if(err != 0) [[alunlikely]]
{
ERR("Failed to get stream latency: 0x%x\n", err);
latency = 0;
neg = 0;
}
- else if UNLIKELY(neg)
+ else if(neg) [[alunlikely]]
latency = 0;
ret.Latency = std::chrono::microseconds{latency};