Commit 61a7bb63 authored by Philippe Gorley's avatar Philippe Gorley Committed by Andreas Traczyk

audio: don't needlessly restart/stop audio layer

Change-Id: Ifc04005addd189d2e4829372cb53ce29152d102c
parent f73eedaf
......@@ -394,8 +394,12 @@ stopCamera()
void
startAudioDevice()
{
ring::Manager::instance().initAudioDriver();
ring::Manager::instance().startAudioDriverStream();
// Don't start audio layer if already done
auto audioLayer = ring::Manager::instance().getAudioDriver();
if (!audioLayer)
ring::Manager::instance().initAudioDriver();
if (!audioLayer->isStarted())
ring::Manager::instance().startAudioDriverStream();
ring::Manager::instance().getVideoManager().audioPreview = ring::getAudioInput(ring::RingBufferPool::DEFAULT_ID);
}
......
......@@ -958,7 +958,11 @@ void
Manager::checkAudio()
{
// FIXME dirty, the manager should not need to be aware of local recorders
if (getCallList().empty() && not ring::LocalRecorderManager::instance().hasRunningRecorders()) {
if (getCallList().empty()
#ifdef RING_VIDEO
and not getVideoManager().audioPreview
#endif
and not ring::LocalRecorderManager::instance().hasRunningRecorders()) {
std::lock_guard<std::mutex> lock(pimpl_->audioLayerMutex_);
if (pimpl_->audiodriver_)
pimpl_->audiodriver_->stopStream();
......
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