summaryrefslogtreecommitdiffstats
path: root/src/audio_core/device/audio_buffers.h
diff options
context:
space:
mode:
authorKelebek1 <eeeedddccc@hotmail.co.uk>2022-08-01 03:58:13 +0200
committerKelebek1 <eeeedddccc@hotmail.co.uk>2022-09-02 05:43:04 +0200
commitea9ff71725113b8dbb159917c57aa536bba0cb53 (patch)
tree512cce0fea5eb511aa7803bc67f741815885bfcb /src/audio_core/device/audio_buffers.h
parentMerge pull request #8752 from vonchenplus/rectangle_texture (diff)
downloadyuzu-ea9ff71725113b8dbb159917c57aa536bba0cb53.tar
yuzu-ea9ff71725113b8dbb159917c57aa536bba0cb53.tar.gz
yuzu-ea9ff71725113b8dbb159917c57aa536bba0cb53.tar.bz2
yuzu-ea9ff71725113b8dbb159917c57aa536bba0cb53.tar.lz
yuzu-ea9ff71725113b8dbb159917c57aa536bba0cb53.tar.xz
yuzu-ea9ff71725113b8dbb159917c57aa536bba0cb53.tar.zst
yuzu-ea9ff71725113b8dbb159917c57aa536bba0cb53.zip
Diffstat (limited to '')
-rw-r--r--src/audio_core/device/audio_buffers.h13
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{};