[Kdenlive-devel] Bug #3181, Crash from setting slow frame rate
Vincent PINON
vincent.pinon at laposte.net
Sun Dec 15 04:27:42 UTC 2013
Hello,
Thanks for your involvement !
I would take option 2, allowing any value of fps, 1 being a workaround
for a design limitation...
displayed fps should be made a float for this case (0.33), or a fraction
(1/3)? As you prefer/have time to do...
Once done can you send a git-formatted patch?
BR,
Vincent
Le 15/12/2013 00:08, Henrikki Almusa a écrit :
> 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?
>
More information about the Kdenlive
mailing list