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,7 +404,16 @@ AVModel::stopPreview() ...@@ -404,7 +404,16 @@ AVModel::stopPreview()
qWarning() << "Can't find preview renderer!"; qWarning() << "Can't find preview renderer!";
return; return;
} }
VideoManager::instance().stopCamera(); // 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(); pimpl_->renderers_[video::PREVIEW_RENDERER_ID]->stopRendering();
} }
......
...@@ -95,7 +95,6 @@ VideoRendererManager::deactivate() ...@@ -95,7 +95,6 @@ VideoRendererManager::deactivate()
disconnect( &interface , &VideoManagerInterface::stoppedDecoding, d_ptr.data(), &VideoRendererManagerPrivate::stoppedDecoding); disconnect( &interface , &VideoManagerInterface::stoppedDecoding, d_ptr.data(), &VideoRendererManagerPrivate::stoppedDecoding);
} }
VideoRendererManager::~VideoRendererManager() VideoRendererManager::~VideoRendererManager()
{ {
// delete d_ptr; // delete d_ptr;
...@@ -170,9 +169,18 @@ Video::Renderer* VideoRendererManager::previewRenderer() ...@@ -170,9 +169,18 @@ Video::Renderer* VideoRendererManager::previewRenderer()
///Stop video preview ///Stop video preview
void VideoRendererManager::stopPreview() void VideoRendererManager::stopPreview()
{ {
VideoManager::instance().stopCamera(); // 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; d_ptr->m_PreviewState = false;
} }
///Start video preview ///Start video preview
...@@ -229,7 +237,6 @@ void VideoRendererManagerPrivate::startedDecoding(const QString& id, const QStri ...@@ -229,7 +237,6 @@ void VideoRendererManagerPrivate::startedDecoding(const QString& id, const QStri
#endif #endif
QThread* t = new QThread(this); QThread* t = new QThread(this);
m_hThreads[r] = t; 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