"Merge Tagged PR 7346"

This commit is contained in:
yuzubot committed 2022-07-05 23:08:55 +00:00
1 parent 03d0840b18
commit 75ac40645e
2 files changed
+16

No files matched your search

+13
View File
@@ -86,6 +86,16 @@ static void VolumeAdjustSamples(std::vector<s16>& samples, float game_volume) {
}
void Stream::PlayNextBuffer(std::chrono::nanoseconds ns_late) {
#ifndef _WIN32
auto now = std::chrono::steady_clock::now();
auto duration = now.time_since_epoch();
auto nanoseconds = std::chrono::duration_cast<std::chrono::nanoseconds>(duration);
if (nanoseconds > expected_cb_time) {
ns_late = nanoseconds - expected_cb_time;
}
#endif
if (!IsPlaying()) {
// Ensure we are in playing state before playing the next buffer
sink_stream.Flush();
@@ -120,6 +130,9 @@ void Stream::PlayNextBuffer(std::chrono::nanoseconds ns_late) {
ns_late = {};
}
#ifndef _WIN32
expected_cb_time = nanoseconds + (buffer_release_ns - ns_late);
#endif
core_timing.ScheduleEvent(buffer_release_ns - ns_late, release_event, {});
}