player/Thread: stop buffering if buffer is full
Shouldn't ever happen, but who knows...
This commit is contained in:
parent
a190db0873
commit
1d00d55d53
|
@ -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
|
||||
|
|
|
@ -944,7 +944,7 @@ Player::Run() noexcept
|
|||
prevent stuttering on slow machines */
|
||||
|
||||
if (pipe->GetSize() < pc.buffered_before_play &&
|
||||
!dc.IsIdle()) {
|
||||
!dc.IsIdle() && !buffer.IsFull()) {
|
||||
/* not enough decoded buffer space yet */
|
||||
|
||||
dc.WaitForDecoder();
|
||||
|
|
Loading…
Reference in New Issue