mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-12-20 01:37:20 +00:00
audio_core: stream: Ensure buffer is valid before release.
This commit is contained in:
parent
06f8c3dc01
commit
c7a06908ae
|
@ -130,7 +130,11 @@ bool Stream::ContainsBuffer([[maybe_unused]] Buffer::Tag tag) const {
|
||||||
std::vector<Buffer::Tag> Stream::GetTagsAndReleaseBuffers(std::size_t max_count) {
|
std::vector<Buffer::Tag> Stream::GetTagsAndReleaseBuffers(std::size_t max_count) {
|
||||||
std::vector<Buffer::Tag> tags;
|
std::vector<Buffer::Tag> tags;
|
||||||
for (std::size_t count = 0; count < max_count && !released_buffers.empty(); ++count) {
|
for (std::size_t count = 0; count < max_count && !released_buffers.empty(); ++count) {
|
||||||
|
if (released_buffers.front()) {
|
||||||
tags.push_back(released_buffers.front()->GetTag());
|
tags.push_back(released_buffers.front()->GetTag());
|
||||||
|
} else {
|
||||||
|
ASSERT_MSG(false, "Invalid tag in released_buffers!");
|
||||||
|
}
|
||||||
released_buffers.pop();
|
released_buffers.pop();
|
||||||
}
|
}
|
||||||
return tags;
|
return tags;
|
||||||
|
@ -140,7 +144,11 @@ std::vector<Buffer::Tag> Stream::GetTagsAndReleaseBuffers() {
|
||||||
std::vector<Buffer::Tag> tags;
|
std::vector<Buffer::Tag> tags;
|
||||||
tags.reserve(released_buffers.size());
|
tags.reserve(released_buffers.size());
|
||||||
while (!released_buffers.empty()) {
|
while (!released_buffers.empty()) {
|
||||||
|
if (released_buffers.front()) {
|
||||||
tags.push_back(released_buffers.front()->GetTag());
|
tags.push_back(released_buffers.front()->GetTag());
|
||||||
|
} else {
|
||||||
|
ASSERT_MSG(false, "Invalid tag in released_buffers!");
|
||||||
|
}
|
||||||
released_buffers.pop();
|
released_buffers.pop();
|
||||||
}
|
}
|
||||||
return tags;
|
return tags;
|
||||||
|
|
Loading…
Reference in a new issue