fix infinite loop in MemoryPCMStream if stream is playing with loop=true
This commit is contained in:
parent
f1cf5c43e6
commit
fc292a57cd
@ -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…
x
Reference in New Issue
Block a user