aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-12-02 22:40:09 -0800
committerChris Robinson <[email protected]>2022-12-02 22:40:09 -0800
commit59f3424ed5796c2cfc622217f56b594dcf31ce5b (patch)
tree10218b9d35c6ac2e0e60cd140ef9126063c4c5a8
parent5c7b8425daf967c8f59a66eb4f21886172c5a1cb (diff)
Fix building with PipeWire 0.3.49 and earlier
-rw-r--r--alc/backends/pipewire.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp
index c8e957b9..057ab34b 100644
--- a/alc/backends/pipewire.cpp
+++ b/alc/backends/pipewire.cpp
@@ -1617,6 +1617,7 @@ void PipeWirePlayback::start()
break;
}
+#if PW_CHECK_VERSION(0,3,50)
/* The time info will be valid when there's a valid rate. Assume
* ptime.avail_buffers+ptime.queued_buffers is the target buffer queue
* size.
@@ -1637,6 +1638,24 @@ void PipeWirePlayback::start()
totalbuffers*updatesize);
break;
}
+#else
+ /* Prior to 0.3.50, we can only measure the delay with the update size,
+ * assuming one buffer and no resample buffering.
+ */
+ if(ptime.rate.denom > 0)
+ {
+ uint updatesize{mRateMatch ? mRateMatch->size : 0u};
+ if(!updatesize) updatesize = mDevice->UpdateSize;
+
+ /* Ensure the delay is in sample frames. */
+ const uint64_t delay{static_cast<uint64_t>(ptime.delay) * mDevice->Frequency *
+ ptime.rate.num / ptime.rate.denom};
+
+ mDevice->UpdateSize = updatesize;
+ mDevice->BufferSize = static_cast<uint>(delay + updatesize);
+ break;
+ }
+#endif
if(!--wait_count)
break;