mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-03 08:39:49 +02:00
x
git-svn-id: svn://elaine/murooma/trunk@196 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
991709d6e4
commit
b4a37941c0
1 changed files with 8 additions and 4 deletions
|
@ -52,7 +52,7 @@ time_point_ms Stream::getNextPlayerChunk(void* outputBuffer, unsigned long frame
|
|||
|
||||
time_point_ms tp = chunk->timePoint();
|
||||
int read = 0;
|
||||
int toRead = framesPerBuffer*channels_ + correction*(hz_*channels_/1000);
|
||||
int toRead = framesPerBuffer + correction*(hz_*chunk->frameSize_/1000);
|
||||
char* buffer;
|
||||
|
||||
if (correction != 0)
|
||||
|
@ -60,7 +60,7 @@ time_point_ms Stream::getNextPlayerChunk(void* outputBuffer, unsigned long frame
|
|||
int msBuffer = floor(framesPerBuffer*2 / (hz_*channels_/1000));
|
||||
if (abs(correction) > msBuffer / 2)
|
||||
correction = copysign(msBuffer / 2, correction);
|
||||
buffer = (char*)malloc(toRead * bytesPerSample_);
|
||||
buffer = (char*)malloc(toRead * chunk->frameSize_);
|
||||
}
|
||||
else
|
||||
buffer = (char*)outputBuffer;
|
||||
|
@ -87,6 +87,7 @@ time_point_ms Stream::getNextPlayerChunk(void* outputBuffer, unsigned long frame
|
|||
// memcpy((char*)outputBuffer + n*bytesPerSample_*channels_, (char*)(chunk->wireChunk->payload) + index*bytesPerSample_*channels_, bytesPerSample_*channels_);
|
||||
}
|
||||
free(buffer);
|
||||
|
||||
/* float factor = (float)toRead / (float)(framesPerBuffer*channels_);
|
||||
std::cout << "correction: " << correction << ", factor: " << factor << "\n";
|
||||
for (size_t n=0; n<framesPerBuffer; ++n)
|
||||
|
@ -96,11 +97,14 @@ time_point_ms Stream::getNextPlayerChunk(void* outputBuffer, unsigned long frame
|
|||
// memcpy((char*)outputBuffer + n*bytesPerSample_*channels_, (char*)(chunk->wireChunk->payload) + index*bytesPerSample_*channels_, bytesPerSample_*channels_);
|
||||
}
|
||||
free(buffer);
|
||||
*/ }
|
||||
*/
|
||||
}
|
||||
|
||||
return tp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
time_point_ms Stream::getNextPlayerChunk(void* outputBuffer, unsigned long framesPerBuffer, int correction)
|
||||
{
|
||||
|
@ -141,6 +145,7 @@ correction = 0;
|
|||
}
|
||||
*/
|
||||
|
||||
|
||||
void Stream::updateBuffers(int age)
|
||||
{
|
||||
pBuffer->add(age);
|
||||
|
@ -160,7 +165,6 @@ void Stream::resetBuffers()
|
|||
void Stream::getPlayerChunk(void* outputBuffer, double outputBufferDacTime, unsigned long framesPerBuffer)
|
||||
{
|
||||
//cout << "framesPerBuffer: " << framesPerBuffer << "\tms: " << framesPerBuffer*2 / PLAYER_CHUNK_MS_SIZE << "\t" << PLAYER_CHUNK_SIZE << "\n";
|
||||
sleep = 0;
|
||||
int msBuffer = floor(framesPerBuffer*2 / (hz_*channels_/1000));
|
||||
|
||||
int ticks = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue