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
|
||||
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];
|
||||
r = std::move(renderer);
|
||||
renderers_mtx_.unlock();
|
||||
|
||||
// Listen and forward id-bound signals upwards.
|
||||
connect(
|
||||
|
@ -965,12 +962,14 @@ AVModelPimpl::addRenderer(const QString& id, const QSize& res, const QString& sh
|
|||
this,
|
||||
[this, id](const QSize& size) { Q_EMIT linked_.rendererStarted(id, size); },
|
||||
Qt::DirectConnection);
|
||||
#ifdef ENABLE_LIBWRAP
|
||||
connect(
|
||||
r.get(),
|
||||
&Renderer::frameBufferRequested,
|
||||
this,
|
||||
[this, id](AVFrame* frame) { Q_EMIT linked_.frameBufferRequested(id, frame); },
|
||||
Qt::DirectConnection);
|
||||
#endif
|
||||
connect(
|
||||
r.get(),
|
||||
&Renderer::frameUpdated,
|
||||
|
|
Loading…
Add table
Reference in a new issue