mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
avmodel: hold lock when erasing renderer
Change-Id: If10ad2bf40ce05b0052016123755f4c9dca18097
This commit is contained in:
parent
9a3634471e
commit
0b11282d88
1 changed files with 6 additions and 7 deletions
|
@ -942,15 +942,12 @@ createRenderer(const QString& id, const QSize& res, const QString& shmPath = {})
|
||||||
void
|
void
|
||||||
AVModelPimpl::addRenderer(const QString& id, const QSize& res, const QString& shmPath)
|
AVModelPimpl::addRenderer(const QString& id, const QSize& res, const QString& shmPath)
|
||||||
{
|
{
|
||||||
// First remove the existing renderer.
|
{
|
||||||
renderers_.erase(id);
|
std::lock_guard<std::mutex> lk(renderers_mtx_);
|
||||||
|
renderers_[id] = createRenderer(id, res, shmPath);
|
||||||
|
}
|
||||||
|
|
||||||
// Create a new one and add it.
|
|
||||||
auto renderer = createRenderer(id, res, shmPath);
|
|
||||||
std::lock_guard<std::mutex> lk(renderers_mtx_);
|
|
||||||
auto& r = renderers_[id];
|
auto& r = renderers_[id];
|
||||||
r = std::move(renderer);
|
|
||||||
renderers_mtx_.unlock();
|
|
||||||
|
|
||||||
// Listen and forward id-bound signals upwards.
|
// Listen and forward id-bound signals upwards.
|
||||||
connect(
|
connect(
|
||||||
|
@ -965,12 +962,14 @@ AVModelPimpl::addRenderer(const QString& id, const QSize& res, const QString& sh
|
||||||
this,
|
this,
|
||||||
[this, id](const QSize& size) { Q_EMIT linked_.rendererStarted(id, size); },
|
[this, id](const QSize& size) { Q_EMIT linked_.rendererStarted(id, size); },
|
||||||
Qt::DirectConnection);
|
Qt::DirectConnection);
|
||||||
|
#ifdef ENABLE_LIBWRAP
|
||||||
connect(
|
connect(
|
||||||
r.get(),
|
r.get(),
|
||||||
&Renderer::frameBufferRequested,
|
&Renderer::frameBufferRequested,
|
||||||
this,
|
this,
|
||||||
[this, id](AVFrame* frame) { Q_EMIT linked_.frameBufferRequested(id, frame); },
|
[this, id](AVFrame* frame) { Q_EMIT linked_.frameBufferRequested(id, frame); },
|
||||||
Qt::DirectConnection);
|
Qt::DirectConnection);
|
||||||
|
#endif
|
||||||
connect(
|
connect(
|
||||||
r.get(),
|
r.get(),
|
||||||
&Renderer::frameUpdated,
|
&Renderer::frameUpdated,
|
||||||
|
|
Loading…
Add table
Reference in a new issue