Commit 3bed65a5 authored by Sébastien Blin's avatar Sébastien Blin

avmodel: get renderers at startup

Daemon 7.1.0 introduces getRenderer to allow the client to restart
renderers if there is a call when starting the client.

Change-Id: I7b1d685d9492780c5ffce5297c8c4214bfd27441
Reviewed-by: Philippe Gorley's avatarPhilippe Gorley <philippe.gorley@savoirfairelinux.com>
parent a52f3203
......@@ -489,6 +489,26 @@ AVModelPimpl::init()
this, &AVModelPimpl::slotCallStateChanged);
connect(&*renderers_[video::PREVIEW_RENDERER_ID], &api::video::Renderer::frameUpdated,
this, &AVModelPimpl::slotFrameUpdated);
auto startedPreview = false;
auto restartRenderers = [&](const QStringList& callList) {
for (const auto& callId : callList)
{
MapStringString rendererInfos = VideoManager::instance().
getRenderer(callId);
auto shmPath = rendererInfos[DRing::Media::Details::SHM_PATH].toStdString();
auto width = rendererInfos[DRing::Media::Details::WIDTH].toInt();
auto height = rendererInfos[DRing::Media::Details::HEIGHT].toInt();
if (width > 0 && height > 0) {
startedPreview = true;
startedDecoding(callId.toStdString(), shmPath, width, height);
}
}
};
restartRenderers(CallManager::instance().getCallList());
restartRenderers(CallManager::instance().getConferenceList());
if (startedPreview)
restartRenderers({"local"});
}
std::string
......@@ -517,7 +537,6 @@ void
AVModelPimpl::startedDecoding(const std::string& id, const std::string& shmPath, int width, int height)
{
const std::string res = std::to_string(width) + "x" + std::to_string(height);
qDebug() << "startedDecoding for sink id: " << id.c_str();
{
std::lock_guard<std::mutex> lk(renderers_mtx_);
auto search = renderers_.find(id);
......
......@@ -230,6 +230,11 @@ public Q_SLOTS: // METHODS
return QString::fromStdString(DRing::startLocalRecorder(audioOnly, path.toStdString()));
}
MapStringString getRenderer(const QString& id)
{
return convertMap(DRing::getRenderer(id.toStdString()));
}
Q_SIGNALS: // SIGNALS
void deviceEvent();
void startedDecoding(const QString &id, const QString &shmPath, int width, int height, bool isMixer);
......
......@@ -190,6 +190,13 @@ public Q_SLOTS: // METHODS
return "/tmp/foobar";
}
MapStringString getRenderer(const QString& id)
{
Q_UNUSED(id)
return {};
}
Q_SIGNALS: // SIGNALS
void deviceEvent();
void startedDecoding(const QString &id, const QString &shmPath, int width, int height, bool isMixer);
......
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