diff options
| author | bunnei <bunneidev@gmail.com> | 2022-09-15 13:50:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-15 13:50:13 -0700 |
| commit | e85bda5f31763359b69fbcad5c121995e1ad7074 (patch) | |
| tree | cd9e85c7fabb334f2d19c20e3eb36c22e1883a21 /src/audio_core/sink/sink_stream.cpp | |
| parent | b5a06bc419a4baf21e22f69c4b6e61e0d2137e5b (diff) | |
| parent | e93e898df528d013e2e0cfeba22e2b6d76bf99b6 (diff) | |
Merge pull request #8878 from Kelebek1/remove_pause
Remove pause callbacks from coretiming
Diffstat (limited to 'src/audio_core/sink/sink_stream.cpp')
| -rw-r--r-- | src/audio_core/sink/sink_stream.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp index 68987eba6..37fe725e4 100644 --- a/src/audio_core/sink/sink_stream.cpp +++ b/src/audio_core/sink/sink_stream.cpp @@ -143,6 +143,12 @@ void SinkStream::ProcessAudioIn(std::span<const s16> input_buffer, std::size_t n const std::size_t frame_size_bytes = frame_size * sizeof(s16); size_t frames_written{0}; + // If we're paused or going to shut down, we don't want to consume buffers as coretiming is + // paused and we'll desync, so just return. + if (system.IsPaused() || system.IsShuttingDown()) { + return; + } + if (queued_buffers > max_queue_size) { Stall(); } @@ -193,6 +199,16 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz const std::size_t frame_size_bytes = frame_size * sizeof(s16); size_t frames_written{0}; + // If we're paused or going to shut down, we don't want to consume buffers as coretiming is + // paused and we'll desync, so just play silence. + if (system.IsPaused() || system.IsShuttingDown()) { + constexpr std::array<s16, 6> silence{}; + for (size_t i = frames_written; i < num_frames; i++) { + std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes); + } + return; + } + // Due to many frames being queued up with nvdec (5 frames or so?), a lot of buffers also get // queued up (30+) but not all at once, which causes constant stalling here, so just let the // video play out without attempting to stall. |
