Hi.

I am investigating Kdenlive bug http://kdenlive.org/mantis/view.php?id=2219 
where moving groups of clips corrupts the timeline. I traced the bug to a 
problem in MLT's playlist "consolidate_blanks" routine.

The problem is a bit complicated, I will try to do my best to describe: the 
playlist gets corrupted, with blank clips having the wrong length (usually a 
blank with length 15000 appears where it should be longer.

Looking at MLT code, "consolidate_blank" recursively calls 
mlt_playlist_resize_clip

The bug is that sometimes in "mlt_playlist_resize_clip", the blank producer 
seems to be disconnected from the playlist's blank (self->blank). Disconnected 
means that they have a different length property.

So, in "mlt_playlist_resize_clip", when we have a blank producer, we get the 
following for example:

mlt_producer_get_length( &self->blank ) returns 38000
and 
mlt_producer_get_length( producer )  returns 15000

and I made sure they are the same producer using:
mlt_producer_cut_parent( producer ) == &self->blank 

My guess is that for some reason the properties for "producer" and "self-
>blank" producer are not in sync, but maybe you have a better idea.

Then in "mlt_playlist_resize_clip", if we try to resize the producer to a 
length of 17000. It only checks for the length of &self->blank, so setting the 
out of producer to 17000 fails and we get an out of 15000 (the producer 
length). 

This results in playlist corruption since consolidate_blanks then changes the 
duration of in between blanks.

Below is a patch that fixes the issue, but it would probably be better to 
understand why the producer can give a length different than the playlist's 
blank.

regards

jb

___________________________________________________________________________

diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c
index 3f8f368..1974db2 100644
--- a/src/framework/mlt_playlist.c
+++ b/src/framework/mlt_playlist.c
@@ -928,6 +928,9 @@ int mlt_playlist_resize_clip( mlt_playlist self, int clip, 
mlt_position in, mlt_
                                mlt_properties_set_int( 
MLT_PRODUCER_PROPERTIES( producer ), "length", out - in + 1 );
                                mlt_producer_set_in_and_out( &self->blank, 0, 
out - in );
                        }
+                       else if ( out - in + 1 > mlt_producer_get_length( 
producer ) ) {
+                               mlt_properties_set_int( 
MLT_PRODUCER_PROPERTIES( producer ), "length", out - in + 1 );
+                       }
                }
 
                if ( in < 0 )

diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c
index 3f8f368..1974db2 100644
--- a/src/framework/mlt_playlist.c
+++ b/src/framework/mlt_playlist.c
@@ -928,6 +928,9 @@ int mlt_playlist_resize_clip( mlt_playlist self, int clip, mlt_position in, mlt_
 				mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( producer ), "length", out - in + 1 );
 				mlt_producer_set_in_and_out( &self->blank, 0, out - in );
 			}
+			else if ( out - in + 1 > mlt_producer_get_length( producer ) ) {
+				mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( producer ), "length", out - in + 1 );
+			}
 		}
 
 		if ( in < 0 )
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to