Commit b19b940d authored by Tristan Matthews's avatar Tristan Matthews

* #18668: manager: fix audiolayer synchronization

parent 88feb6fa
......@@ -107,9 +107,7 @@ void AudioLayer::notifyIncomingCall()
tone.getNext(buf, nbSample);
/* Put the data in the urgent ring buffer */
Manager::instance().audioLayerMutexLock();
flushUrgent();
putUrgent(buf, sizeof buf);
Manager::instance().audioLayerMutexUnlock();
}
......@@ -364,7 +364,7 @@ IAXVoIPLink::offhold(const std::string& id)
iax_unquelch(call->session);
}
Manager::instance().getAudioDriver()->startStream();
Manager::instance().startAudioDriverStream();
call->setState(Call::ACTIVE);
}
......@@ -570,7 +570,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
Manager::instance().peerAnsweredCall(id);
Manager::instance().getAudioDriver()->startStream();
Manager::instance().startAudioDriverStream();
Manager::instance().getMainBuffer().flushAllBuffers();
break;
......
......@@ -2874,3 +2874,9 @@ void ManagerImpl::clearHistory()
{
history_.clear();
}
void ManagerImpl::startAudioDriverStream()
{
ost::MutexLock lock(audioLayerMutex_);
audiodriver_->startStream();
}
......@@ -151,6 +151,8 @@ class ManagerImpl {
return audiodriver_;
}
void startAudioDriverStream();
/**
* Functions which occur with a user's action
* Place a new call
......@@ -795,14 +797,6 @@ class ManagerImpl {
void initAudioDriver();
void audioLayerMutexLock() {
audioLayerMutex_.enterMutex();
}
void audioLayerMutexUnlock() {
audioLayerMutex_.leaveMutex();
}
/**
* Load the accounts order set by the user from the sflphonedrc config file
* @return std::vector<std::string> A vector containing the account ID's
......
......@@ -1805,9 +1805,7 @@ void sdp_media_update_cb(pjsip_inv_session *inv, pj_status_t status)
return;
try {
Manager::instance().audioLayerMutexLock();
Manager::instance().getAudioDriver()->startStream();
Manager::instance().audioLayerMutexUnlock();
Manager::instance().startAudioDriverStream();
std::vector<AudioCodec*> audioCodecs;
for (std::vector<sfl::AudioCodec*>::const_iterator i = sessionMedia.begin(); i != sessionMedia.end(); ++i) {
......
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