From f6848f65f011dd2e89e617d1f6b99dd55192b3ad Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@d8a302eb-03bc-478d-80e4-98257eca68ef> Date: Sat, 9 Aug 2014 11:53:58 +0000 Subject: [PATCH] cardBuffer git-svn-id: svn://elaine/murooma/trunk@165 d8a302eb-03bc-478d-80e4-98257eca68ef --- stream.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/stream.cpp b/stream.cpp index daf1a691..04608e5e 100644 --- a/stream.cpp +++ b/stream.cpp @@ -101,6 +101,20 @@ void Stream::getPlayerChunk(short* outputBuffer, double outputBufferDacTime, uns { //cout << "framesPerBuffer: " << framesPerBuffer << "\tms: " << framesPerBuffer*2 / PLAYER_CHUNK_MS_SIZE << "\t" << PLAYER_CHUNK_SIZE << "\n"; int msBuffer = floor(framesPerBuffer*2 / PLAYER_CHUNK_MS_SIZE); + + int ticks = 0; + long currentTick = getTickCount(); + if (lastTick == 0) + lastTick = currentTick; + ticks = currentTick - lastTick; + lastTick = currentTick; + + int cardBuffer = 0; + if (ticks > 1) + pCardBuffer->add(ticks); + if (pCardBuffer->full()) + cardBuffer = pCardBuffer->percentil(90); + int correction = 0; if (sleep != 0) { @@ -143,20 +157,14 @@ void Stream::getPlayerChunk(short* outputBuffer, double outputBufferDacTime, uns int age = Chunk::getAge(getNextPlayerChunk(outputBuffer, framesPerBuffer, correction)) - bufferMs;// + outputBufferDacTime*1000; - long currentTick = getTickCount(); - if (lastTick == 0) - lastTick = currentTick; - - if (currentTick - lastTick > 1) - pCardBuffer->add(currentTick - lastTick); - cout << age << "\t" << msBuffer << "\t" << currentTick - lastTick << "\tcardBuffer: " << pCardBuffer->percentil(90) << "\n"; - lastTick = currentTick; if (outputBufferDacTime < 1) age += outputBufferDacTime*1000; if (pCardBuffer->full()) age += pCardBuffer->percentil(90); + + cout << age << "\t" << msBuffer << "\t" << ticks << "\tcardBuffer: " << cardBuffer << "\n"; // cout << age << "\t" << outputBufferDacTime*1000 << "\n";