[Kdenlive-devel] Bug #3181, Crash from setting slow frame rate
Henrikki Almusa
henrikki.almusa at gmail.com
Sat Dec 14 23:08:39 UTC 2013
Hi all,
I've been looking into bug 3181.
http://www.kdenlive.org/mantis/view.php?id=3181
The bug is triggered when framerate is set to 3/1 or slower (so 3
seconds per frame). What happens is division by 0 error from
Timecode.cpp line 414:
int frames = framenumber % m_displayedFramesPerSecond;
In there the m_displayedFramesPerSecond is 0. This is set earlier:
void Timecode::setFormat(double framesPerSecond, Formats format)
{
m_displayedFramesPerSecond = (int)(framesPerSecond + 0.5);
m_dropFrameTimecode = (framesPerSecond / 1.00 !=
(int)framesPerSecond) ;
m_format = format;
m_realFps = framesPerSecond;
if (m_dropFrameTimecode) {
m_dropFrames = round(m_realFps * .066666); //Number of frames
to drop on the minute marks is the nearest integer to 6% of the framerate
m_framesPer10Minutes = round(m_realFps * 600); //Number of
frames per ten minutes
}
}
So in situations where framesPerSecond is less than 0.5 (eg. 3/1 in the
dialog -> framesPerSecond is 0.3333...) the m_displayedFramesPerSecond
becomes 0, leading to crash.
So I can figure out two ways to solve this:
1. Profile dialog could prevent giving more than 2 for first value in
frame rate (or just set it 1 and disallow changing it)
2. The Timecode.cpp needs to be changed to allow 0 in
m_displayedFramesPerSecond.
Which one would be better (or a third option)? If 1, where should I poke
my head to do this?
--
Henrikki Almusa
More information about the Kdenlive
mailing list