mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-11 15:21:45 +02:00
cleanup
git-svn-id: svn://elaine/murooma/trunk@147 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
a499f6561d
commit
72f2afcf24
2 changed files with 6 additions and 20 deletions
21
stream.cpp
21
stream.cpp
|
@ -24,19 +24,7 @@ void Stream::setBufferLen(size_t bufferLenMs)
|
||||||
|
|
||||||
void Stream::addChunk(Chunk* chunk)
|
void Stream::addChunk(Chunk* chunk)
|
||||||
{
|
{
|
||||||
// Chunk* c = new Chunk(*chunk);
|
|
||||||
// mutex.lock();
|
|
||||||
chunks.push(shared_ptr<Chunk>(chunk));
|
chunks.push(shared_ptr<Chunk>(chunk));
|
||||||
// mutex.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
shared_ptr<Chunk> Stream::getNextChunk()
|
|
||||||
{
|
|
||||||
if (!chunk)
|
|
||||||
chunk = chunks.pop();
|
|
||||||
return chunk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +38,9 @@ void Stream::getSilentPlayerChunk(short* outputBuffer)
|
||||||
|
|
||||||
time_point_ms Stream::getNextPlayerChunk(short* outputBuffer, int correction)
|
time_point_ms Stream::getNextPlayerChunk(short* outputBuffer, int correction)
|
||||||
{
|
{
|
||||||
chunk = getNextChunk();
|
if (!chunk)
|
||||||
|
chunk = chunks.pop();
|
||||||
|
|
||||||
time_point_ms tp = chunk->timePoint();
|
time_point_ms tp = chunk->timePoint();
|
||||||
int read = 0;
|
int read = 0;
|
||||||
int toRead = PLAYER_CHUNK_SIZE + correction*PLAYER_CHUNK_MS_SIZE;
|
int toRead = PLAYER_CHUNK_SIZE + correction*PLAYER_CHUNK_MS_SIZE;
|
||||||
|
@ -65,10 +55,7 @@ time_point_ms Stream::getNextPlayerChunk(short* outputBuffer, int correction)
|
||||||
{
|
{
|
||||||
read += chunk->read(buffer + read, toRead - read);
|
read += chunk->read(buffer + read, toRead - read);
|
||||||
if (chunk->isEndOfChunk())
|
if (chunk->isEndOfChunk())
|
||||||
{
|
chunk = chunks.pop();
|
||||||
chunk = NULL;
|
|
||||||
chunk = getNextChunk();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (correction != 0)
|
if (correction != 0)
|
||||||
|
|
5
stream.h
5
stream.h
|
@ -18,13 +18,12 @@ class Stream
|
||||||
public:
|
public:
|
||||||
Stream();
|
Stream();
|
||||||
void addChunk(Chunk* chunk);
|
void addChunk(Chunk* chunk);
|
||||||
std::shared_ptr<Chunk> getNextChunk();
|
|
||||||
time_point_ms getNextPlayerChunk(short* outputBuffer, int correction = 0);
|
|
||||||
void getSilentPlayerChunk(short* outputBuffer);
|
|
||||||
void getChunk(short* outputBuffer, double outputBufferDacTime, unsigned long framesPerBuffer);
|
void getChunk(short* outputBuffer, double outputBufferDacTime, unsigned long framesPerBuffer);
|
||||||
void setBufferLen(size_t bufferLenMs);
|
void setBufferLen(size_t bufferLenMs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
time_point_ms getNextPlayerChunk(short* outputBuffer, int correction = 0);
|
||||||
|
void getSilentPlayerChunk(short* outputBuffer);
|
||||||
void sleepMs(int ms);
|
void sleepMs(int ms);
|
||||||
|
|
||||||
int sleep;
|
int sleep;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue