git-svn-id: svn://elaine/murooma/trunk@147 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-08-06 21:00:51 +00:00
parent a499f6561d
commit 72f2afcf24
2 changed files with 6 additions and 20 deletions

View file

@ -24,19 +24,7 @@ void Stream::setBufferLen(size_t bufferLenMs)
void Stream::addChunk(Chunk* chunk)
{
// Chunk* c = new Chunk(*chunk);
// mutex.lock();
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)
{
chunk = getNextChunk();
if (!chunk)
chunk = chunks.pop();
time_point_ms tp = chunk->timePoint();
int read = 0;
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);
if (chunk->isEndOfChunk())
{
chunk = NULL;
chunk = getNextChunk();
}
chunk = chunks.pop();
}
if (correction != 0)