mirror of
https://github.com/clangen/musikcube.git
synced 2025-03-14 04:18:36 +00:00
Don't try to be smart about buffer fill rate -- just keep it full. Also,
use std::deque instead of std::list to maintain the buffer collection in Player -- it has better performance characteristics for what we're doing.
This commit is contained in:
parent
5849a7a8f9
commit
f3564378f4
@ -110,7 +110,7 @@ namespace musik { namespace core { namespace audio {
|
||||
|
||||
using MixPointPtr = std::shared_ptr<MixPoint>;
|
||||
using MixPointList = std::list<MixPointPtr>;
|
||||
using BufferList = std::list<BufferPtr>;
|
||||
using BufferList = std::deque<BufferPtr>;
|
||||
using ListenerList = std::list<EventListener*>;
|
||||
using OutputPtr = std::shared_ptr<musik::core::sdk::IOutput>;
|
||||
|
||||
|
@ -184,16 +184,10 @@ inline BufferPtr Stream::GetEmptyBuffer() {
|
||||
}
|
||||
|
||||
BufferPtr Stream::GetNextProcessedOutputBuffer() {
|
||||
BufferPtr currentBuffer;
|
||||
|
||||
/* if the buffer fill rate falls below 50%, go ahead
|
||||
and refill it... */
|
||||
if (!this->done && this->filledBuffers.size() < this->bufferCount / 2) {
|
||||
this->RefillInternalBuffers();
|
||||
}
|
||||
this->RefillInternalBuffers();
|
||||
|
||||
if (this->filledBuffers.size()) {
|
||||
currentBuffer = this->filledBuffers.front();
|
||||
BufferPtr currentBuffer = this->filledBuffers.front();
|
||||
this->filledBuffers.pop_front();
|
||||
this->ApplyDsp(currentBuffer);
|
||||
return currentBuffer;
|
||||
@ -250,7 +244,7 @@ void Stream::RefillInternalBuffers() {
|
||||
}
|
||||
else {
|
||||
continue; /* already consumed all of the decoder buffer. go back
|
||||
to the top of the loop to get some more data. */
|
||||
to the top of the loop to get some more data. */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,6 @@ namespace musik { namespace core { namespace audio {
|
||||
virtual bool OpenStream(std::string uri);
|
||||
|
||||
private:
|
||||
void RecycleBuffer(BufferPtr oldBuffer);
|
||||
bool GetNextBufferFromDecoder();
|
||||
BufferPtr GetEmptyBuffer();
|
||||
void ApplyDsp(BufferPtr buffer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user