diff options
author | Billy Laws <blaws05@gmail.com> | 2023-03-18 20:52:02 +0000 |
---|---|---|
committer | Billy Laws <blaws05@gmail.com> | 2023-03-26 22:48:57 +0100 |
commit | d8fc3f403b62e2b3d67ec08791fdc66847ddb4ac (patch) | |
tree | 7a5e37809980a7c4988df5845e6daf161d7e859f /src/audio_core/device | |
parent | 8da1a4ea22964728782e29a392e088c510951355 (diff) |
audio: Interpolate system manager sample count using host sink sample info
This avoids the need to stall if the host sink sporadically misses the deadline, in such a case the previous implementation would report them samples as being played on-time, causing the guest to send more samples and leading to a gradual buildup.
Diffstat (limited to 'src/audio_core/device')
-rw-r--r-- | src/audio_core/device/device_session.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/audio_core/device/device_session.cpp b/src/audio_core/device/device_session.cpp index 5a327a606..ad0f40e28 100644 --- a/src/audio_core/device/device_session.cpp +++ b/src/audio_core/device/device_session.cpp @@ -121,8 +121,7 @@ u64 DeviceSession::GetPlayedSampleCount() const { } std::optional<std::chrono::nanoseconds> DeviceSession::ThreadFunc() { - // Add 5ms of samples at a 48K sample rate. - played_sample_count += 48'000 * INCREMENT_TIME / 1s; + played_sample_count = stream->GetExpectedPlayedSampleCount(); if (type == Sink::StreamType::Out) { system.AudioCore().GetAudioManager().SetEvent(Event::Type::AudioOutManager, true); } else { |