aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/alffplay.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/alffplay.cpp b/examples/alffplay.cpp
index 27520a6d..f02fb16b 100644
--- a/examples/alffplay.cpp
+++ b/examples/alffplay.cpp
@@ -992,6 +992,18 @@ int AudioState::handler()
*/
alSourceRewind(mSource);
alSourcei(mSource, AL_BUFFER, 0);
+ if(alcGetInteger64vSOFT)
+ {
+ /* Also update the device start time with the current device
+ * clock, so the decoder knows we're running behind.
+ */
+ int64_t devtime{};
+ alcGetInteger64vSOFT(alcGetContextsDevice(alcGetCurrentContext()),
+ ALC_DEVICE_CLOCK_SOFT, 1, &devtime);
+ auto device_time = nanoseconds{devtime};
+
+ mDeviceStartTime = device_time - mCurrentPts;
+ }
continue;
}