mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-13 16:21:47 +02:00
server tick
git-svn-id: svn://elaine/murooma/trunk@109 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
d684686b47
commit
146c856f03
2 changed files with 6 additions and 6 deletions
|
@ -33,9 +33,9 @@ int main () {
|
|||
timeval tvChunk;
|
||||
gettimeofday(&tvChunk, NULL);
|
||||
long nextTick = getTickCount();
|
||||
while (cin.good())
|
||||
while (!cin.bad())
|
||||
{
|
||||
for (size_t n=0; (n<WIRE_CHUNK_SIZE) && cin.good(); ++n)
|
||||
for (size_t n=0; (n<WIRE_CHUNK_SIZE) && !cin.bad(); ++n)
|
||||
{
|
||||
c[0] = cin.get();
|
||||
c[1] = cin.get();
|
||||
|
@ -48,8 +48,8 @@ int main () {
|
|||
zmq::message_t message(sizeof(Chunk));
|
||||
memcpy(message.data(), chunk, sizeof(Chunk));
|
||||
publisher.send(message);
|
||||
addMs(tvChunk, WIRE_CHUNK_MS);
|
||||
|
||||
addMs(tvChunk, WIRE_CHUNK_MS);
|
||||
nextTick += WIRE_CHUNK_MS;
|
||||
long currentTick = getTickCount();
|
||||
if (nextTick > currentTick)
|
||||
|
|
|
@ -149,10 +149,12 @@ void Stream::getChunk(short* outputBuffer, double outputBufferDacTime, unsigned
|
|||
}
|
||||
else
|
||||
{
|
||||
for (size_t i=0; i<chunks.size(); ++i)
|
||||
std::cerr << "Chunk " << i << ": " << getAge(chunks[i]) - bufferMs << "\n";
|
||||
for (int i=0; i<(int)(round((float)sleep / (float)PLAYER_CHUNK_MS)) + 1; ++i)
|
||||
{
|
||||
// std::cerr << "Sleep: " << sleep << "\n";
|
||||
getNextPlayerChunk(outputBuffer);
|
||||
std::cerr << getAge(getNextPlayerChunk(outputBuffer)) - bufferMs << "\t";
|
||||
usleep(10);
|
||||
}
|
||||
sleep = 0;
|
||||
|
@ -206,8 +208,6 @@ void Stream::getChunk(short* outputBuffer, double outputBufferDacTime, unsigned
|
|||
if (sleep != 0)
|
||||
{
|
||||
std::cerr << "Sleep: " << sleep << "\n";
|
||||
for (size_t i=0; i<chunks.size(); ++i)
|
||||
std::cerr << "Chunk " << i << ": " << getAge(chunks[i]) - bufferMs << "\n";
|
||||
}
|
||||
//sleep = 0;
|
||||
std::cerr << "Chunk: " << age << "\t" << shortMedian << "\t" << median << "\t" << pBuffer->size() << "\t" << outputBufferDacTime*1000 << "\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue