diff options
author | Chris Robinson <[email protected]> | 2018-11-18 05:38:03 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-18 05:38:03 -0800 |
commit | de13f30e286358d8e4f41e457421e4ec9776e3f5 (patch) | |
tree | b0a73ddb120bdfd798814c50ae3174a1cfa08684 /examples/alffplay.cpp | |
parent | 0851dc12b4f21483b6f9002db4718ded99cbeb57 (diff) |
Improve audio underrun recordery in alffplay
Now it has a better idea to skip samples during refill instead of after
restarting.
Diffstat (limited to 'examples/alffplay.cpp')
-rw-r--r-- | examples/alffplay.cpp | 12 |
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; } |