mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-11 08:06:41 +02:00
buffering
git-svn-id: svn://elaine/murooma/trunk@41 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
3b40a08f1e
commit
1b1200e88c
2 changed files with 4 additions and 4 deletions
2
chunk.h
2
chunk.h
|
@ -1,7 +1,7 @@
|
|||
#ifndef CHUNK_H
|
||||
#define CHUNK_H
|
||||
|
||||
#define MS (40)
|
||||
#define MS (20)
|
||||
//44100 / 20 = 2205
|
||||
#define SAMPLE_RATE (44100)
|
||||
#define SIZE (SAMPLE_RATE*4*MS/1000)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "doubleBuffer.h"
|
||||
|
||||
|
||||
DoubleBuffer<int> buffer(60000 / MS);
|
||||
DoubleBuffer<int> buffer(30000 / MS);
|
||||
std::deque<Chunk*> chunks;
|
||||
std::deque<int> timeDiffs;
|
||||
std::mutex mtx;
|
||||
|
@ -189,14 +189,14 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
|
|||
int median = buffer.median();
|
||||
std::cerr << "age: " << getAge(*chunk) << "\t" << age << "\t" << median << "\t" << buffer.size() << "\t" << timeInfo->outputBufferDacTime*1000 << "\n";
|
||||
|
||||
if (!buffer.full() && (age > bufferMs + 2*MS))
|
||||
if (/*!buffer.full() &&*/ (age > bufferMs + 2*MS))
|
||||
{
|
||||
chunks->pop_front();
|
||||
delete chunk;
|
||||
std::cerr << "packe too old, dropping\n";
|
||||
usleep(100);
|
||||
}
|
||||
else if (!buffer.full() && (age < bufferMs - 2*MS))
|
||||
else if (/*!buffer.full() &&*/ (age < bufferMs - 2*MS))
|
||||
{
|
||||
chunk = new Chunk();
|
||||
memset(&(chunk->payload[0]), 0, SIZE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue