player/Thread: stop buffering if buffer is full

Shouldn't ever happen, but who knows...
This commit is contained in:
Max Kellermann
2018-09-21 19:05:25 +02:00
parent a190db0873
commit 1d00d55d53
2 changed files with 7 additions and 2 deletions

View File

@@ -29,7 +29,7 @@
*/
class MusicBuffer {
/** a mutex which protects #buffer */
Mutex mutex;
mutable Mutex mutex;
SliceBuffer<MusicChunk> buffer;
@@ -53,6 +53,11 @@ public:
}
#endif
bool IsFull() const noexcept {
const std::lock_guard<Mutex> protect(mutex);
return buffer.IsFull();
}
/**
* Returns the total number of reserved chunks in this buffer. This
* is the same value which was passed to the constructor