Skip to content
Snippets Groups Projects
Commit 1b273662 authored by Philippe Gorley's avatar Philippe Gorley Committed by Andreas Traczyk
Browse files

avmodel: don't stop camera if active video calls

If, during a call, the user goes to the media settings and back to the
call, a SIP renegotiation was triggered, stopping the camera. If there
are existing calls (active renderers), don't stop the camera.

Change-Id: If3875157f7f27a55af4bfc3f08e08a78c951bd26
parent 62cd1e14
Branches
No related tags found
No related merge requests found
......@@ -404,6 +404,15 @@ AVModel::stopPreview()
qWarning() << "Can't find preview renderer!";
return;
}
// If an active call does not have video muted, don't stop the camera
// stopCamera() calls switchInput(""), which disables the camera
bool previewShouldBeStopped = true;
for (auto it = pimpl_->renderers_.cbegin(); it != pimpl_->renderers_.cend(); ++it) {
if (it->second->getId() != video::PREVIEW_RENDERER_ID)
// If rendering, don't stop preview
previewShouldBeStopped &= !it->second->isRendering();
}
if (previewShouldBeStopped)
VideoManager::instance().stopCamera();
pimpl_->renderers_[video::PREVIEW_RENDERER_ID]->stopRendering();
}
......
......@@ -95,7 +95,6 @@ VideoRendererManager::deactivate()
disconnect( &interface , &VideoManagerInterface::stoppedDecoding, d_ptr.data(), &VideoRendererManagerPrivate::stoppedDecoding);
}
VideoRendererManager::~VideoRendererManager()
{
// delete d_ptr;
......@@ -170,6 +169,15 @@ Video::Renderer* VideoRendererManager::previewRenderer()
///Stop video preview
void VideoRendererManager::stopPreview()
{
// If an active call does not have video muted, don't stop the camera
// stopCamera() calls switchInput(""), which disables the camera
bool previewShouldBeStopped = true;
for (auto it = d_ptr->m_hRenderers.begin(); it != d_ptr->m_hRenderers.end(); ++it) {
if (it.key() != PREVIEW_RENDERER_ID)
// If rendering, don't stop preview
previewShouldBeStopped &= !it.value()->isRendering();
}
if (previewShouldBeStopped)
VideoManager::instance().stopCamera();
d_ptr->m_PreviewState = false;
......@@ -229,7 +237,6 @@ void VideoRendererManagerPrivate::startedDecoding(const QString& id, const QStri
#endif
QThread* t = new QThread(this);
m_hThreads[r] = t;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment