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:
casey langen 2017-01-02 23:07:40 -08:00
parent 5849a7a8f9
commit f3564378f4
3 changed files with 4 additions and 11 deletions

View File

@ -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>;

View File

@ -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. */
}
}

View File

@ -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);