mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix infinite loop in MemoryPCMStream if stream is playing with loop=true
This commit is contained in:
parent
f1cf5c43e6
commit
fc292a57cd
1 changed files with 1 additions and 4 deletions
|
|
@ -24,12 +24,9 @@ void MemoryPCMStream::close() {
|
|||
}
|
||||
|
||||
size_t MemoryPCMStream::read(char* dst, size_t bufferSize) {
|
||||
if (!open) {
|
||||
if (!open || buffer.empty()) {
|
||||
return PCMStream::ERROR;
|
||||
}
|
||||
if (buffer.empty()) {
|
||||
return 0;
|
||||
}
|
||||
size_t count = std::min<size_t>(bufferSize, buffer.size());
|
||||
std::memcpy(dst, buffer.data(), count);
|
||||
buffer.erase(buffer.begin(), buffer.begin() + count);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue