diff options
author | bunnei <bunneidev@gmail.com> | 2022-09-10 20:01:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-10 20:01:11 +0200 |
commit | cd4b9bffb2d42b1f8d4386b251a35344891df55a (patch) | |
tree | 53454fa29c30e9fa7f1f2c31f9586839d799f277 /src/audio_core/device/audio_buffers.h | |
parent | Merge pull request #8863 from german77/triggers (diff) | |
parent | Don't stall with nvdec (diff) | |
download | yuzu-cd4b9bffb2d42b1f8d4386b251a35344891df55a.tar yuzu-cd4b9bffb2d42b1f8d4386b251a35344891df55a.tar.gz yuzu-cd4b9bffb2d42b1f8d4386b251a35344891df55a.tar.bz2 yuzu-cd4b9bffb2d42b1f8d4386b251a35344891df55a.tar.lz yuzu-cd4b9bffb2d42b1f8d4386b251a35344891df55a.tar.xz yuzu-cd4b9bffb2d42b1f8d4386b251a35344891df55a.tar.zst yuzu-cd4b9bffb2d42b1f8d4386b251a35344891df55a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/audio_core/device/audio_buffers.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/audio_core/device/audio_buffers.h b/src/audio_core/device/audio_buffers.h index 5d1979ea0..57c78d439 100644 --- a/src/audio_core/device/audio_buffers.h +++ b/src/audio_core/device/audio_buffers.h @@ -58,6 +58,7 @@ public: if (index < 0) { index += N; } + out_buffers.push_back(buffers[index]); registered_count++; registered_index = (registered_index + 1) % append_limit; @@ -100,7 +101,7 @@ public: } // Check with the backend if this buffer can be released yet. - if (!session.IsBufferConsumed(buffers[index].tag)) { + if (!session.IsBufferConsumed(buffers[index])) { break; } @@ -280,6 +281,16 @@ public: return true; } + u64 GetNextTimestamp() const { + // Iterate backwards through the buffer queue, and take the most recent buffer's end + std::scoped_lock l{lock}; + auto index{appended_index - 1}; + if (index < 0) { + index += append_limit; + } + return buffers[index].end_timestamp; + } + private: /// Buffer lock mutable std::recursive_mutex lock{}; |