Commit a5bad769 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#5738] Refactor mutex protecting audiolayer

parent a5564b30
......@@ -112,7 +112,7 @@ void Conference::bindParticipant (CallID participant_id)
while (iter != _participants.end()) {
if (participant_id != (*iter)) {
Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID (participant_id, *iter);
Manager::instance().getMainBuffer()->bindCallID (participant_id, *iter);
}
iter++;
......@@ -121,7 +121,7 @@ void Conference::bindParticipant (CallID participant_id)
}
Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID (participant_id);
Manager::instance().getMainBuffer()->bindCallID (participant_id);
}
......
This diff is collapsed.
......@@ -1108,11 +1108,15 @@ class ManagerImpl
*/
bool initAudioDriver (void);
/*
ost::Mutex* getAudioLayerMutex() {
return &_audiolayer_mutex;
}
*/
/**
* Enter the mutex for the audio layer
*/
void audioLayerMutexLock(void) { _audiolayerMutex.enterMutex(); }
/**
* Leave the mutex for audio layer
*/
void audioLayerMutexUnlock(void) { _audiolayerMutex.leaveMutex(); }
/**
* Helper function that creates an MD5 Hash from the credential
......@@ -1218,18 +1222,29 @@ class ManagerImpl
/** Mutex to protect access to code section */
ost::Mutex _mutex;
ost::Mutex _audiolayer_mutex;
/**
* Mutex used to protect audio layer
*/
ost::Mutex _audiolayerMutex;
// Multithread variable (non protected)
/**
* Multithread variable (non protected)
*/
DBusManagerImpl * _dbus;
/** Waiting Call Vectors */
/**
* Waiting Call Vectors
*/
CallIDSet _waitingCall;
/** Protect waiting call list, access by many voip/audio threads */
/**
* Protect waiting call list, access by many voip/audio threads
*/
ost::Mutex _waitingCallMutex;
/** Number of waiting call, synchronize with waitingcall callidvector */
/**
* Number of waiting call, synchronize with waitingcall callidvector
*/
unsigned int _nbIncomingWaitingCall;
/**
......@@ -1254,7 +1269,7 @@ class ManagerImpl
/**
* Path of the ConfigFile
*/
std::string _path;
std::string _path;
int _setupLoaded;
......
......@@ -81,9 +81,12 @@ ManagerImpl::registerAccounts()
iter++;
}
audioLayerMutexLock();
// calls the client notification here in case of errors at startup...
if (_audiodriver -> getErrorMessage() != -1)
notifyErrClient (_audiodriver -> getErrorMessage());
if (_audiodriver->getErrorMessage() != -1) {
notifyErrClient (_audiodriver->getErrorMessage());
}
audioLayerMutexUnlock();
ASSERT (flag, true);
......@@ -120,9 +123,12 @@ ManagerImpl::initRegisterAccounts()
iter++;
}
audioLayerMutexLock();
// calls the client notification here in case of errors at startup...
if (_audiodriver -> getErrorMessage() != -1)
notifyErrClient (_audiodriver -> getErrorMessage());
if (_audiodriver->getErrorMessage() != -1) {
notifyErrClient (_audiodriver->getErrorMessage());
}
audioLayerMutexUnlock();
ASSERT (flag, true);
......
......@@ -3491,7 +3491,10 @@ void sdp_media_update_cb (pjsip_inv_session *inv, pj_status_t status)
try {
call->setAudioStart (true);
Manager::instance().getAudioDriver()->startStream(); //->startStream();
Manager::instance().audioLayerMutexLock();
Manager::instance().getAudioDriver()->startStream();
Manager::instance().audioLayerMutexUnlock();
// udate session media only if required
if (pl != call->getAudioRtp()->getSessionMedia()) {
......
Supports Markdown
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