From 8f1ba8bf214f3e2fbad91a047e9c47c6ba60431b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20=C3=96nnerby?= Date: Wed, 24 Dec 2008 00:21:33 +0000 Subject: [PATCH] Forgot to release the audio::Buffer for recycling. --- src/core/audio/Player.cpp | 1 + src/core/audio/Stream.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/core/audio/Player.cpp b/src/core/audio/Player.cpp index b25cdb91f..0e9b5b7a5 100644 --- a/src/core/audio/Player.cpp +++ b/src/core/audio/Player.cpp @@ -311,6 +311,7 @@ void Player::ReleaseBuffer(IBuffer *buffer){ for(BufferList::iterator foundBuffer=this->lockedBuffers.begin();foundBuffer!=this->lockedBuffers.end();++foundBuffer){ if(foundBuffer->get()==buffer){ this->totalBufferSize -= buffer->Bytes(); + this->stream->DeleteBuffer(*foundBuffer); this->lockedBuffers.erase(foundBuffer); // Calculate current position from front locked buffer diff --git a/src/core/audio/Stream.h b/src/core/audio/Stream.h index 5c1704c84..e24b564e6 100644 --- a/src/core/audio/Stream.h +++ b/src/core/audio/Stream.h @@ -49,6 +49,7 @@ namespace musik { namespace core { namespace audio { // Forward declare class Stream; +class Player; typedef boost::shared_ptr StreamPtr; ////////////////////////////////////////////////////////////////////////////// @@ -78,6 +79,8 @@ class Stream { BufferPtr GetNextDecoderBuffer(); BufferPtr GetNextBuffer(); + private: + friend class Player; BufferPtr NewBuffer(); void DeleteBuffer(BufferPtr oldBuffer);