Commit 3fa417d3 authored by Tristan Matthews's avatar Tristan Matthews

mainbuffer: remove dead code

parent fbd7d73c
......@@ -39,17 +39,13 @@
const char * const MainBuffer::DEFAULT_ID = "audiolayer_id";
MainBuffer::MainBuffer() : ringBufferMap_(), callIDMap_(), mutex_(), internalSamplingRate_(8000)
{
//pthread_mutex_init(&mutex_, NULL);
}
{}
MainBuffer::~MainBuffer()
{
// delete any ring buffers that didn't get removed
for (auto &item : ringBufferMap_)
delete item.second;
//pthread_mutex_destroy(&mutex_);
}
void MainBuffer::setInternalSamplingRate(int sr)
......@@ -233,7 +229,6 @@ void MainBuffer::unBindAll(const std::string & call_id)
unBindCallID(call_id, item_set);
}
//void MainBuffer::putData(void *buffer, size_t toCopy, const std::string &call_id)
void MainBuffer::putData(AudioBuffer& buffer, const std::string &call_id)
{
std::lock_guard<std::mutex> guard(mutex_);
......@@ -244,7 +239,6 @@ void MainBuffer::putData(AudioBuffer& buffer, const std::string &call_id)
ring_buffer->put(buffer);
}
//size_t MainBuffer::getData(void *buffer, size_t toCopy, const std::string &call_id)
size_t MainBuffer::getData(AudioBuffer& buffer, const std::string &call_id)
{
std::lock_guard<std::mutex> guard(mutex_);
......@@ -259,7 +253,7 @@ size_t MainBuffer::getData(AudioBuffer& buffer, const std::string &call_id)
CallIDSet::iterator iter_id = callid_set->begin();
if (iter_id != callid_set->end())
return getDataByID(buffer, *iter_id, call_id); //return getDataByID(buffer, toCopy, *iter_id, call_id);
return getDataByID(buffer, *iter_id, call_id);
else
return 0;
} else {
......@@ -287,12 +281,6 @@ size_t MainBuffer::getDataByID(AudioBuffer& buffer, const std::string & call_id,
return ring_buffer ? ring_buffer->get(buffer, reader_id) : 0;
}
/*size_t MainBuffer::getDataByID(void *buffer, size_t toCopy, const std::string & call_id, const std::string & reader_id)
{
RingBuffer* ring_buffer = getRingBuffer(call_id);
return ring_buffer ? ring_buffer->get(buffer, toCopy, reader_id) : 0;
}*/
size_t MainBuffer::availableForGet(const std::string &call_id)
{
std::lock_guard<std::mutex> guard(mutex_);
......@@ -391,49 +379,3 @@ void MainBuffer::flushAllBuffers()
for (auto &item : ringBufferMap_)
item.second->flushAll();
}
void MainBuffer::dumpInfo()
{
#if 0
std::lock_guard<std::mutex> guard(mutex_);
// print each call and bound call ids
for (const auto &item_call : callIDMap_) {
std::string dbg_str(" Call: \t");
dbg_str.append(item_call.first);
dbg_str.append(" is bound to: \t");
CallIDSet *call_id_set = item_call.second;
for (const auto &item : *call_id_set) {
dbg_str.append(item);
dbg_str.append(", ");
}
DEBUG("%s", dbg_str.c_str());
}
// Print ringbuffers ids and readpointers
for (const auto &item_buffer : ringBufferMap_) {
std::string dbg_str(" Buffer: \t");
dbg_str.append(item_buffer.first);
dbg_str.append(" as read pointer: \t");
RingBuffer* rbuffer = item_buffer.second;
if (rbuffer) {
ReadPointer* rpointer = rbuffer->getReadPointerList();
if (rpointer) {
for (const auto &item : *rpointer) {
dbg_str.append(item.first);
dbg_str.append(", ");
}
}
}
DEBUG("%s", dbg_str.c_str());
}
#endif
}
......@@ -96,8 +96,6 @@ class MainBuffer {
void flushAllBuffers();
void dumpInfo();
private:
NON_COPYABLE(MainBuffer);
......
......@@ -160,8 +160,6 @@ Call::toggleRecording()
mbuffer.unBindHalfDuplexOut(process_id, MainBuffer::DEFAULT_ID);
}
Manager::instance().getMainBuffer().dumpInfo();
return startRecording;
}
......
......@@ -371,8 +371,6 @@ bool ManagerImpl::outgoingCall(const std::string& account_id,
return false;
}
getMainBuffer().dumpInfo();
return true;
}
......@@ -429,8 +427,6 @@ bool ManagerImpl::answerCall(const std::string& call_id)
// Connect streams
addStream(call_id);
getMainBuffer().dumpInfo();
// Start recording if set in preference
if (audioPreference.getIsAlwaysRecording())
toggleRecordingCall(call_id);
......@@ -504,7 +500,6 @@ bool ManagerImpl::hangupCall(const std::string& callId)
}
}
getMainBuffer().dumpInfo();
return true;
}
......@@ -530,8 +525,6 @@ bool ManagerImpl::hangupConference(const std::string& id)
unsetCurrentCall();
getMainBuffer().dumpInfo();
return true;
}
......@@ -577,7 +570,6 @@ bool ManagerImpl::onHoldCall(const std::string& callId)
client_.getCallManager()->callStateChanged(callId, "HOLD");
getMainBuffer().dumpInfo();
return result;
}
......@@ -631,7 +623,6 @@ bool ManagerImpl::offHoldCall(const std::string& callId)
addStream(callId);
getMainBuffer().dumpInfo();
return result;
}
......@@ -659,8 +650,6 @@ bool ManagerImpl::transferCall(const std::string& callId, const std::string& to)
// remove waiting call in case we make transfer without even answer
removeWaitingCall(callId);
getMainBuffer().dumpInfo();
return true;
}
......@@ -724,7 +713,6 @@ bool ManagerImpl::refuseCall(const std::string& id)
// Disconnect streams
removeStream(id);
getMainBuffer().dumpInfo();
return true;
}
......@@ -1109,7 +1097,6 @@ ManagerImpl::joinParticipant(const std::string& callId1, const std::string& call
conf->setRecordingSmplRate(audiodriver_->getSampleRate());
}
getMainBuffer().dumpInfo();
return true;
}
......@@ -1161,7 +1148,6 @@ void ManagerImpl::createConfFromParticipantList(const std::vector< std::string >
conf->setRecordingSmplRate(audiodriver_->getSampleRate());
}
getMainBuffer().dumpInfo();
} else {
delete conf;
}
......@@ -1258,8 +1244,6 @@ void ManagerImpl::removeParticipant(const std::string& call_id)
removeStream(call_id);
getMainBuffer().dumpInfo();
client_.getCallManager()->conferenceChanged(conf->getConfID(), conf->getStateStr());
processRemainingParticipants(*conf);
......@@ -1353,15 +1337,12 @@ void ManagerImpl::addStream(const std::string& call_id)
audiodriver_->flushUrgent();
audiodriver_->flushMain();
}
getMainBuffer().dumpInfo();
}
void ManagerImpl::removeStream(const std::string& call_id)
{
DEBUG("Remove audio stream %s", call_id.c_str());
getMainBuffer().unBindAll(call_id);
getMainBuffer().dumpInfo();
}
//THREAD=Main
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment