mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-21 13:06:15 +02:00
buffer size
git-svn-id: svn://elaine/murooma/trunk@77 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
5361199d87
commit
36e0ffe7ee
3 changed files with 10 additions and 1 deletions
|
@ -168,6 +168,8 @@ int main (int argc, char *argv[])
|
|||
std::cerr << "Unsuccessful in setting thread realtime prio" << std::endl;
|
||||
*/
|
||||
stream = new Stream();
|
||||
stream->setBufferLen(bufferMs);
|
||||
|
||||
initAudio();
|
||||
Chunk* chunk;// = new Chunk();
|
||||
while (1)
|
||||
|
|
|
@ -15,6 +15,12 @@ Stream::Stream() : sleep(0), lastPlayerChunk(NULL), median(0), shortMedian(0), l
|
|||
}
|
||||
|
||||
|
||||
void Stream::setBufferLen(size_t bufferLenMs)
|
||||
{
|
||||
bufferMs = bufferLenMs;
|
||||
}
|
||||
|
||||
|
||||
void Stream::addChunk(Chunk* chunk)
|
||||
{
|
||||
Chunk* c = new Chunk(*chunk);
|
||||
|
@ -213,7 +219,7 @@ void Stream::getChunk(short* outputBuffer, double outputBufferDacTime, unsigned
|
|||
lastUpdate = now;
|
||||
median = pBuffer->median();
|
||||
shortMedian = pShortBuffer->median();
|
||||
if (abs(age) > 300)
|
||||
if (abs(age) > 700)
|
||||
sleep = age;
|
||||
else if (pShortBuffer->full() && (abs(shortMedian) > WIRE_CHUNK_MS))
|
||||
sleep = shortMedian;
|
||||
|
|
1
stream.h
1
stream.h
|
@ -19,6 +19,7 @@ public:
|
|||
timeval getNextPlayerChunk(short* outputBuffer, int correction = 0);
|
||||
void getSilentPlayerChunk(short* outputBuffer);
|
||||
void getChunk(short* outputBuffer, double outputBufferDacTime, unsigned long framesPerBuffer);
|
||||
void setBufferLen(size_t bufferLenMs);
|
||||
|
||||
private:
|
||||
void sleepMs(int ms);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue