git-svn-id: svn://elaine/murooma/trunk@218 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-08-29 05:36:48 +00:00
parent 9c6ee38ce4
commit 763d17defc
8 changed files with 361 additions and 4 deletions

View file

@ -2,6 +2,8 @@
#include <boost/lexical_cast.hpp>
#include <iostream>
#include "common/log.h"
#include "oggDecoder.h"
#include "pcmDecoder.h"
#define PCM_DEVICE "default"
@ -45,6 +47,7 @@ void Receiver::stop()
void Receiver::worker()
{
active_ = true;
PcmDecoder decoder;
while (active_)
{
try
@ -64,8 +67,9 @@ void Receiver::worker()
//cout << "WireChunk length: " << wireChunk->length << ", sec: " << wireChunk->tv_sec << ", usec: " << wireChunk->tv_usec << "\n";
wireChunk->payload = (char*)malloc(wireChunk->length);
socketRead(&s, wireChunk->payload, wireChunk->length);
stream_->addChunk(new Chunk(stream_->format, wireChunk));
Chunk* chunk = new Chunk(stream_->format, wireChunk);
if (decoder.decode(chunk))
stream_->addChunk(chunk);
}
}
catch (const std::exception& e)