Commit 45c4e5e6 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix freeze on memory usage loading invalid clips

parent 25ba5eaa
Pipeline #36553 passed with stage
in 33 minutes and 43 seconds
......@@ -313,6 +313,12 @@ bool AudioThumbJob::startJob()
return false;
}
m_lengthInFrames = m_prod->get_length(); // Multiply this if we want more than 1 sample per frame
if (m_lengthInFrames == INT_MAX) {
// This is a broken file or live feed, don't attempt to generate audio thumbnails
m_done = true;
m_successful = false;
return false;
}
m_frequency = m_binClip->audioInfo()->samplingRate();
m_frequency = m_frequency <= 0 ? 48000 : m_frequency;
......
......@@ -411,6 +411,19 @@ bool LoadJob::startJob()
m_errorMessage.append(i18n("ERROR: Could not load clip %1: producer is invalid", m_resource));
return false;
}
if (m_producer->get_length() == INT_MAX && m_producer->get("eof") == QLatin1String("loop")) {
// This is a live source or broken clip
m_done = true;
m_successful = false;
if (m_producer) {
m_producer.reset();
}
qDebug()<<"=== MAX DURATION: "<<INT_MAX<<", DURATION: "<<(INT_MAX / 25 / 60);
QMetaObject::invokeMethod(pCore.get(), "displayBinMessage", Qt::QueuedConnection, Q_ARG(QString, i18n("Cannot get duration for file %1", m_resource)),
Q_ARG(int, (int)KMessageWidget::Warning));
m_errorMessage.append(i18n("ERROR: Could not load clip %1: producer is invalid", m_resource));
return false;
}
processProducerProperties(m_producer, m_xml);
QString clipName = Xml::getXmlProperty(m_xml, QStringLiteral("kdenlive:clipname"));
if (clipName.isEmpty()) {
......
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