Bug 375163

Summary: Playing sub clip zone to end shortens time ruler for all sub clips and master clip
Product: [Applications] kdenlive Reporter: mikko.rapeli
Component: Rendering & ExportAssignee: Jean-Baptiste Mardelle <jb>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: git-master   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: example project with the problem

Description mikko.rapeli 2017-01-16 22:10:11 UTC
To reproduce:

 * start a new project
 * add a 5 second color clip
 * play color clip and set in at 1 seconds out at 2 seconds
 * press ctrl-i to add a sub clip
 * play color clip and set new in at 3 seconds out at 4 seconds
 * press cctrl-i to add a new sub clip

Now project has one clip with two sub clips.

 * Play zone of sub clip one with out at, ctrl space.
 * select sub clip two.
 * Try to play zone with ctrl space.

Notice how time ruler for all clips is now shortened to the end of the just played zone. Thus playback of other zones or the main clip fails. With some combination of play from start & play zone, it is possible to play beyond zone end and if one waits for 5 seconds, then selecting another clip brings full 5 second back to visibility on time ruler.

I have been trying to understand the code in question but have failed so far. Setting a break point to Monitor::adjustRulerSize shows a stack trace how subclips out marker somehow propagatest to ruler size. Or this debug print:

@@ -1257,6 +1263,7 @@ void Monitor::rendererStopped(int pos)
 
 void Monitor::adjustRulerSize(int length, int offset)
 {
+    qDebug("%s, length = %d, offset = %d\n", __func__, length, offset);
     if (length > 0) {
         m_length = length;
     }


My workflow with kdenlive has been to load all clips and preprocess them in clip bin with in and out points and possibly sub clips, which I then later start to assemble to time line. Sadly this bug or bugs make the whole sub clip feature usable and breaks my workflow when playback and adjustments to project bin clips suddenly can no longer be done. Oh, and the problem persists over project saves :(
Comment 1 mikko.rapeli 2017-01-16 22:13:00 UTC
Also, reloading the clip does not help. Would be nice to be able to reload all mlt consumers/providers of a clip in project bin.
Comment 2 mikko.rapeli 2017-01-16 22:17:33 UTC
Created attachment 103448 [details]
example project with the problem

Example project attached.
Comment 3 mikko.rapeli 2017-01-16 22:50:52 UTC
Here is a stack trace from Monitor::adjustRulerSize break point where
5 second color clip (125 frames) sub clip (in 32, out 52 frames) zone has played and user clicked to go back to main clip. This shows how adjust ruler size gets the out point of sub clip zone instead of master clip lenght:

#0  Monitor::adjustRulerSize (this=0x83233b18, length=52, offset=0)
    at ./src/monitor/monitor.cpp:1265
        __func__ = "adjustRulerSize"
#1  0xb49ab31e in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#2  0xb49ab82d in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#3  0x8052afb7 in Render::durationChanged (this=0x82dbea88, 
    _t1=<optimized out>, _t2=<optimized out>)
    at ./obj-i686-linux-gnu/src/kdenlive_automoc.dir/moc_renderer_VICSJME6EZCM5A.cpp:449
        _a = {0x0, 0xbff2eb84, 0xbff2eb88}
#4  0x8050ee4a in Render::setProducer (this=0x82dbea88, producer=0x8482ea28, 
    position=<optimized out>, isActive=true) at ./src/renderer.cpp:402
        locker = {val = 2195450613}
        currentId = {static null = {<No data fields>}, d = 0x8482ea40}
        consumerPosition = <optimized out>
        __func__ = "setProducer"
#5  0x803f549f in Monitor::slotOpenClip (this=0x83233b18, 
    controller=0x847fd598, in=-1, out=-1) at ./src/monitor/monitor.cpp:1442
        __func__ = "slotOpenClip"
#6  0xb49ab31e in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#7  0xb49ab82d in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#8  0x8052314a in Bin::openClip (this=0x82227840, _t1=<optimized out>, 
    _t2=<optimized out>, _t3=<optimized out>)
    at ./obj-i686-linux-gnu/src/kdenlive_automoc.dir/moc_bin_J3XKS2NPU2Q4TD.cpp:1582
        _a = {0x0, 0xbff2ed5c, 0xbff2ed98, 0xbff2ed9c}
#9  0x804a0310 in Bin::openProducer (this=0x82227840, controller=0x847fd598)
    at ./src/bin/bin.cpp:2053
No locals.
#10 0x804bea62 in ProjectClip::setCurrent (this=0x846a5050, current=true, 
    notify=true) at ./src/bin/projectclip.cpp:292
        current = true
        notify = true
        this = 0x846a5050
#11 0x804a4671 in Bin::selectProxyModel (this=0x82227840, id=...)
    at ./src/bin/bin.cpp:1442
No locals.
#12 0xb49ab31e in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#13 0xb49ab82d in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#14 0x80523832 in ProjectSortProxyModel::selectModel (this=0x8223c588, _t1=...)
    at ./obj-i686-linux-gnu/src/kdenlive_automoc.dir/moc_projectsortpro_I7YDFX434VDHKQ.cpp:150
        _a = {0x0, 0x92e43708}
#15 0x804ca342 in ProjectSortProxyModel::onCurrentRowChanged (this=0x8223c588, 
    current=..., previous=...) at ./src/bin/projectsortproxymodel.cpp:132
        ix = <optimized out>
        indexes = {<QListSpecialMethods<QModelIndex>> = {<No data fields>}, {
            p = {static shared_null = {ref = {atomic = {
                    _q_value = {<std::__atomic_base<int>> = {
                        static _S_alignment = 4, 
                        _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, 
                end = 0, array = {0x0}}, d = 0x8346c668}, d = 0x8346c668}}
#16 0xb49ab31e in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#17 0xb49ab82d in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#18 0xb4927946 in QItemSelectionModel::selectionChanged(QItemSelection const&, QItemSelection const&) () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#19 0xb492c4b6 in QItemSelectionModel::emitSelectionChanged(QItemSelection const&, QItemSelection const&) () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#20 0xb4930419 in QItemSelectionModel::select(QItemSelection const&, QFlags<QItemSelectionModel::SelectionFlag>) ()
   from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#21 0xb5d5884f in QTreeViewPrivate::select(QModelIndex const&, QModelIndex const&, QFlags<QItemSelectionModel::SelectionFlag>) ()
   from /usr/lib/i386-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#22 0xb5d58f52 in QTreeView::setSelection(QRect const&, QFlags<QItemSelectionModel::SelectionFlag>) () from /usr/lib/i386-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#23 0xb5d13948 in QAbstractItemView::mousePressEvent(QMouseEvent*) ()
   from /usr/lib/i386-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#24 0xb5d5d95f in QTreeView::mousePressEvent(QMouseEvent*) ()
   from /usr/lib/i386-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#25 0x804adea9 in MyTreeView::mousePressEvent (this=0x83bc73d8, 
    event=0xbff2fac4) at ./src/bin/bin.cpp:100
No locals.
#26 0xb5adecbe in QWidget::event(QEvent*) ()
   from /usr/lib/i386-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#27 0xb5bd75ea in QFrame::event(QEvent*) ()
   from /usr/lib/i386-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#28 0xb5c6e7cc in QAbstractScrollArea::viewportEvent(QEvent*) ()
   from /usr/lib/i386-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#29 0xb5d17d9a in QAbstractItemView::viewportEvent(QEvent*) ()
   from /usr/lib/i386-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#30 0xb5d5d30d in QTreeView::viewportEvent(QEvent*) ()
   from /usr/lib/i386-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#31 0xb497c982 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
No symbol table info available.
#32 0xb5a91109 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
Comment 4 mikko.rapeli 2017-01-17 20:39:39 UTC
Patch proposal: https://mail.kde.org/pipermail/kdenlive/2017-January/009561.html
Comment 5 Jean-Baptiste Mardelle 2017-01-20 13:30:07 UTC
Git commit f540402274e8db9912136e8aacfe60fe124e2c7d by Jean-Baptiste Mardelle, on behalf of Mikko Rapeli.
Committed on 20/01/2017 at 13:23.
Pushed by mardelle into branch 'Applications/16.12'.

Fix playing Zone breaks monitor ruler length

M  +1    -1    src/renderer.cpp

https://commits.kde.org/kdenlive/f540402274e8db9912136e8aacfe60fe124e2c7d