aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends
diff options
context:
space:
mode:
Diffstat (limited to 'alc/backends')
-rw-r--r--alc/backends/jack.cpp4
-rw-r--r--alc/backends/opensl.cpp2
-rw-r--r--alc/backends/pulseaudio.cpp26
3 files changed, 16 insertions, 16 deletions
diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp
index 2b0131b3..afa26b23 100644
--- a/alc/backends/jack.cpp
+++ b/alc/backends/jack.cpp
@@ -340,7 +340,7 @@ int JackPlayback::processRt(jack_nframes_t numframes) noexcept
out[numchans++] = static_cast<float*>(jack_port_get_buffer(port, numframes));
}
- if LIKELY(mPlaying.load(std::memory_order_acquire))
+ if(mPlaying.load(std::memory_order_acquire)) [[allikely]]
mDevice->renderSamples({out.data(), numchans}, static_cast<uint>(numframes));
else
{
@@ -364,7 +364,7 @@ int JackPlayback::process(jack_nframes_t numframes) noexcept
}
jack_nframes_t total{0};
- if LIKELY(mPlaying.load(std::memory_order_acquire))
+ if(mPlaying.load(std::memory_order_acquire)) [[allikely]]
{
auto data = mRing->getReadVector();
jack_nframes_t todo{minu(numframes, static_cast<uint>(data.first.len))};
diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp
index 48642496..901d2ebe 100644
--- a/alc/backends/opensl.cpp
+++ b/alc/backends/opensl.cpp
@@ -148,7 +148,7 @@ const char *res_str(SLresult result) noexcept
}
#define PRINTERR(x, s) do { \
- if UNLIKELY((x) != SL_RESULT_SUCCESS) \
+ if((x) != SL_RESULT_SUCCESS) [[alunlikely]] \
ERR("%s: %s\n", (s), res_str((x))); \
} while(0)
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};