diff --git a/daemon/src/audio/audiolayer.cpp b/daemon/src/audio/audiolayer.cpp index cb1374b3d6facd52f6dd0bcef9342fde6279a84d..ca0342e2e88793582c59424faaa1b437179937fe 100644 --- a/daemon/src/audio/audiolayer.cpp +++ b/daemon/src/audio/audiolayer.cpp @@ -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(); } diff --git a/daemon/src/iax/iaxvoiplink.cpp b/daemon/src/iax/iaxvoiplink.cpp index bb94a4d535fd43796683de0d33739870238bfaec..840dee2598241b81da806585a9af6b4093ea7264 100644 --- a/daemon/src/iax/iaxvoiplink.cpp +++ b/daemon/src/iax/iaxvoiplink.cpp @@ -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; diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index fa3557a06397ab86f462c7fcb0573e2a9a71bd6a..6a7dab9715c79382cc411660fd5142a1ea82c54b 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -2874,3 +2874,9 @@ void ManagerImpl::clearHistory() { history_.clear(); } + +void ManagerImpl::startAudioDriverStream() +{ + ost::MutexLock lock(audioLayerMutex_); + audiodriver_->startStream(); +} diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h index f52a3433caccf55050851cdea797b55224c59781..7b3e9e71fc9d541978702444b5a72bb7c95796e3 100644 --- a/daemon/src/managerimpl.h +++ b/daemon/src/managerimpl.h @@ -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 diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp index c2dcc535c6bbca37ad131b33f5c2ad87a9532819..cc4d1fcf4d358b117480a7b54ee5be8aa57aaea3 100644 --- a/daemon/src/sip/sipvoiplink.cpp +++ b/daemon/src/sip/sipvoiplink.cpp @@ -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) {