mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-10 07:36:41 +02:00
git-svn-id: svn://elaine/murooma/trunk@136 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
130d7c5643
commit
a11a3e4959
3 changed files with 17 additions and 4 deletions
13
chunk.cpp
13
chunk.cpp
|
@ -1,9 +1,11 @@
|
|||
#include "chunk.h"
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
Chunk::Chunk(WireChunk* _wireChunk) : idx(0), wireChunk(_wireChunk)
|
||||
Chunk::Chunk(WireChunk* _wireChunk) : idx(0)
|
||||
{
|
||||
wireChunk = new WireChunk(*_wireChunk);
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,6 +21,15 @@ bool Chunk::isEndOfChunk()
|
|||
}
|
||||
|
||||
|
||||
bool Chunk::getNext(int16_t& _result)
|
||||
{
|
||||
if (isEndOfChunk())
|
||||
return false;
|
||||
_result = wireChunk->payload[idx++];
|
||||
result = true;
|
||||
}
|
||||
|
||||
|
||||
int Chunk::read(short* _outputBuffer, int _count)
|
||||
{
|
||||
int result = _count;
|
||||
|
|
2
chunk.h
2
chunk.h
|
@ -39,6 +39,8 @@ public:
|
|||
int read(short* _outputBuffer, int _count);
|
||||
bool isEndOfChunk();
|
||||
|
||||
bool getNext(int16_t& _result);
|
||||
|
||||
inline time_point_ms timePoint()
|
||||
{
|
||||
time_point_ms tp;
|
||||
|
|
|
@ -22,9 +22,9 @@ void Stream::setBufferLen(size_t bufferLenMs)
|
|||
|
||||
void Stream::addChunk(Chunk* chunk)
|
||||
{
|
||||
Chunk* c = new Chunk(*chunk);
|
||||
// Chunk* c = new Chunk(*chunk);
|
||||
// mutex.lock();
|
||||
chunks.push_back(c);
|
||||
chunks.push_back(chunk);
|
||||
// mutex.unlock();
|
||||
cv.notify_all();
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ time_point_ms Stream::getNextPlayerChunk(short* outputBuffer, int correction)
|
|||
{
|
||||
Chunk* chunk = getNextChunk();
|
||||
time_point_ms tp = chunk->timePoint();
|
||||
/*
|
||||
|
||||
if (correction != 0)
|
||||
{
|
||||
float idx(chunk->idx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue