Call the ThreadedSource::cleanup() from reimplemented method in descendants.

Spaced and moved together the class methods in source code (aestethic).


git-svn-id: http://yate.null.ro/svn/yate/trunk@2829 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2009-09-08 13:19:22 +00:00
parent 5e07d86bba
commit 8b19f1915a
2 changed files with 39 additions and 20 deletions

View File

@ -163,6 +163,7 @@ private:
AlsaChan *s_chan = 0;
AlsaDevice* s_dev = 0;
bool AlsaSource::init()
{
m_brate = 16000;
@ -218,12 +219,13 @@ void AlsaSource::run()
Debug(DebugWarn,"AlsaSource [%p] end of data",this);
}
void AlsaSource::cleanup()
{
Debug(DebugNote,"AlsaSource [%p] cleanup, total=%u",this,m_total);
ThreadedSource::cleanup();
}
bool AlsaConsumer::init()
{
m_total = 0;
@ -253,6 +255,7 @@ unsigned long AlsaConsumer::Consume(const DataBlock &data, unsigned long tStamp,
return invalidStamp();
}
AlsaChan::AlsaChan(const String& dev)
: CallEndpoint("alsa"),
m_dev(dev)
@ -298,6 +301,7 @@ bool AlsaChan::init()
return true;
}
AlsaDevice::AlsaDevice(const String& dev,bool init)
: m_dev(dev), m_dev_in(dev), m_dev_out(dev), m_closed(true),
m_handle_in(0), m_handle_out(0)
@ -317,7 +321,6 @@ AlsaDevice::AlsaDevice(const String& dev,bool init)
open();
};
bool AlsaDevice::open()
{
int err;
@ -386,7 +389,6 @@ bool AlsaDevice::open()
return true;
}
AlsaDevice::~AlsaDevice()
{
Debug(DebugNote,"AlsaDevice::~AlsaDevice [%p]",this);
@ -461,6 +463,7 @@ bool AlsaDevice::timePassed(void)
return Time::now() > m_lastTime;
}
void AlsaChan::disconnected(bool final, const char *reason)
{
Debugger debug("AlsaChan::disconnected()"," '%s' [%p]",reason,this);
@ -479,6 +482,7 @@ void AlsaChan::answer()
Engine::enqueue(m);
}
bool AlsaHandler::received(Message &msg)
{
String dest(msg.getValue("callto"));
@ -558,6 +562,7 @@ bool AlsaHandler::received(Message &msg)
return true;
}
bool StatusHandler::received(Message &msg)
{
const String* sel = msg.getParam("module");
@ -567,6 +572,7 @@ bool StatusHandler::received(Message &msg)
return false;
}
bool DropHandler::received(Message &msg)
{
String id(msg.getValue("id"));
@ -580,6 +586,7 @@ bool DropHandler::received(Message &msg)
return false;
}
bool MasqHandler::received(Message &msg)
{
String id(msg.getValue("id"));
@ -594,6 +601,7 @@ bool MasqHandler::received(Message &msg)
return false;
}
bool AttachHandler::received(Message &msg)
{
if (s_dev)
@ -660,6 +668,7 @@ bool AttachHandler::received(Message &msg)
return !more;
}
AlsaPlugin::AlsaPlugin()
: m_handler(0)
{

View File

@ -166,6 +166,7 @@ private:
OssChan *s_chan = 0;
bool OssSource::init()
{
m_brate = 16000;
@ -239,6 +240,7 @@ void OssSource::run()
void OssSource::cleanup()
{
Debug(DebugAll,"OssSource [%p] cleanup, total=%u",this,m_total);
ThreadedSource::cleanup();
}
bool OssConsumer::init()
@ -288,6 +290,7 @@ unsigned long OssConsumer::Consume(const DataBlock &data, unsigned long tStamp,
return invalidStamp();
}
OssChan::OssChan(const String& dev)
: CallEndpoint("oss"),
m_dev(dev)
@ -331,6 +334,25 @@ bool OssChan::init()
return true;
}
void OssChan::disconnected(bool final, const char *reason)
{
Debugger debug("OssChan::disconnected()"," '%s' [%p]",reason,this);
setTarget();
}
void OssChan::answer()
{
Message* m = new Message("call.answered");
m->addParam("module","oss");
String tmp("oss/");
tmp += m_dev;
m->addParam("id",tmp);
if (m_target)
m->addParam("targetid",m_target);
Engine::enqueue(m);
}
OssDevice::OssDevice(const String& dev)
: m_dev(dev), m_fullDuplex(false), m_readMode(true), m_fd(-1)
{
@ -449,23 +471,6 @@ int OssDevice::setOutputMode(bool force)
return 1;
}
void OssChan::disconnected(bool final, const char *reason)
{
Debugger debug("OssChan::disconnected()"," '%s' [%p]",reason,this);
setTarget();
}
void OssChan::answer()
{
Message* m = new Message("call.answered");
m->addParam("module","oss");
String tmp("oss/");
tmp += m_dev;
m->addParam("id",tmp);
if (m_target)
m->addParam("targetid",m_target);
Engine::enqueue(m);
}
bool OssHandler::received(Message &msg)
{
@ -547,6 +552,7 @@ bool OssHandler::received(Message &msg)
return true;
}
bool StatusHandler::received(Message &msg)
{
const String* sel = msg.getParam("module");
@ -556,6 +562,7 @@ bool StatusHandler::received(Message &msg)
return false;
}
bool DropHandler::received(Message &msg)
{
String id(msg.getValue("id"));
@ -569,6 +576,7 @@ bool DropHandler::received(Message &msg)
return false;
}
bool MasqHandler::received(Message &msg)
{
String id(msg.getValue("id"));
@ -583,6 +591,7 @@ bool MasqHandler::received(Message &msg)
return false;
}
bool AttachHandler::received(Message &msg)
{
int more = 2;
@ -647,6 +656,7 @@ bool AttachHandler::received(Message &msg)
return !more;
}
OssPlugin::OssPlugin()
: m_handler(0)
{