summaryrefslogtreecommitdiff
path: root/src/audio_core
diff options
context:
space:
mode:
authorGravatar Billy Laws2023-04-02 17:29:07 +0100
committerGravatar Billy Laws2023-04-03 23:11:36 +0100
commit0afb9631b53de1a747fc9ba46ed37781b04ef492 (patch)
treea6ec92c10363f3fe6869c3f3d44e5396f5670622 /src/audio_core
parentMerge pull request #10024 from german77/crysis (diff)
downloadyuzu-0afb9631b53de1a747fc9ba46ed37781b04ef492.tar.gz
yuzu-0afb9631b53de1a747fc9ba46ed37781b04ef492.tar.xz
yuzu-0afb9631b53de1a747fc9ba46ed37781b04ef492.zip
Add some explicit latency to sample count reporting
Some games have very tight scheduling requirements for their audio which can't really be matched on the host, adding a constant to the reported value helps to provide some leeway.
Diffstat (limited to 'src/audio_core')
-rw-r--r--src/audio_core/sink/sink_stream.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp
index f99dbd8ec..13c73b5d7 100644
--- a/src/audio_core/sink/sink_stream.cpp
+++ b/src/audio_core/sink/sink_stream.cpp
@@ -266,7 +266,8 @@ u64 SinkStream::GetExpectedPlayedSampleCount() {
266 auto exp_played_sample_count{min_played_sample_count + 266 auto exp_played_sample_count{min_played_sample_count +
267 (TargetSampleRate * time_delta) / std::chrono::seconds{1}}; 267 (TargetSampleRate * time_delta) / std::chrono::seconds{1}};
268 268
269 return std::min<u64>(exp_played_sample_count, max_played_sample_count); 269 // Add 15ms of latency in sample reporting to allow for some leeway in scheduler timings
270 return std::min<u64>(exp_played_sample_count, max_played_sample_count) + TargetSampleCount * 3;
270} 271}
271 272
272void SinkStream::WaitFreeSpace() { 273void SinkStream::WaitFreeSpace() {