added stream.cpp

git-svn-id: svn://elaine/murooma/trunk@72 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-07-05 21:29:51 +00:00
parent 18b3901c57
commit ff2e24e219
5 changed files with 176 additions and 414 deletions

View file

@ -16,12 +16,13 @@
#include <thread>
#include <portaudio.h>
#include "chunk.h"
#include "timeUtils.h"
#include "stream.h"
std::deque<int> timeDiffs;
int bufferMs;
std::mutex mutex;
void player()
@ -50,7 +51,9 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
(void) statusFlags;
(void) inputBuffer;
mutex.lock();
PlayerChunk* playerChunk = stream->getChunk(timeInfo->outputBufferDacTime, framesPerBuffer);
mutex.unlock();
for (size_t n=0; n<framesPerBuffer; n++)
{
@ -180,7 +183,9 @@ int main (int argc, char *argv[])
// memcpy(chunk, update.data(), sizeof(Chunk));
chunk = (Chunk*)(update.data());
// std::cerr << "New chunk: " << chunkTime(*chunk) << "\t" << timeToStr(now) << "\t" << getAge(*chunk) << "\n";
mutex.lock();
stream->addChunk(chunk);
mutex.unlock();
}
return 0;
}