On Sunday 13 April 2014 12.23:31 Dan Dennedy wrote:
> On Sun, Apr 13, 2014 at 2:19 AM, jbm <j...@kdenlive.org> wrote:
> > Hi Dan and everyone.
> > 
> > I have been silent for almost a year due to some health issue, but I am
> > fine now and slowly starting to work again on Kdenlive.
> > 
> > A recent Movit related commit creates a huge memory leak when seeking in
> 
> > Kdenlive. The responsible commit is this one:
> Do you have more information about what conditions are needed to
> reproduce this? Do I have to disable opengl? Do I have to apply
> cropping? I am not seeing the problem while scrubbing over a video
> clip for quite a while within Shotcut. I tested both with opengl
> module in use and not and with both cropping and not. Is it only when
> using a color or image producer?

Ok, I did some more testing.
The problem happens with mpegts interlaced clips that were taken from a sony 
camcorder (the same happens with HDV interlaced clips captured with dvgrab), 
using the xgl consumer.

Using MLT from current git with these mpegts interlaced clips, I get the 
following results:

melt myclip.MTS
= works fine

melt myclip.MTS -consumer xgl
= crashes (backtrace at the end of the mail)

melt -profile atsc_1080p_50 myclip.MTS -consumer xgl
= plays but huge memleak (2 GB of memory used after 20 seconds)


Reverting the recent change in filter_movit_crop.cpp by re-adding at line 56:
*format = mlt_image_none;

Fixes the crash and memleak in xgl consumer (and Kdenlive).
I am using movit from today's git if it is relevant...

I can mail you a sample clip if you need it.

regards
jb


- - - - FFMpeg info about the clip  - - - - - -

Input #0, mpegts, from '00023.MTS':
  Duration: 00:00:14.02, start: 1.040000, bitrate: 10268 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 
1440x1080 [SAR 4:3 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, 
fltp, 256 kb/s
    Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 
0x0090), 1920x1080


 - - - -xgl crash backtrace  - - - - -


Thread 13 (Thread 0x7fffdbc08700 (LWP 25416)):
#0  __GI___pthread_mutex_lock (mutex=0x0) at ../nptl/pthread_mutex_lock.c:66
#1  0x00007ffff7bbc4e5 in mlt_properties_lock (self=self@entry=0x7fffc4406520) 
at 
mlt_properties.c:2061
---Type <return> to continue, or q <return> to quit---
#2  0x00007ffff7bbcb6e in mlt_properties_find (name=<optimized out>, 
self=0x7fffc4406520) at mlt_properties.c:506
#3  mlt_properties_get (self=0x7fffc4406520, name=0x7fffe88bddd1 "_unique_id") 
at mlt_properties.c:782
#4  0x00007fffe88b5fda in GlslManager::get_frame_specific_data 
(service=service@entry=0x7fffc4406520, frame=frame@entry=0x7fffc42bad90, 
    key=key@entry=0x7fffe88bddef "_movit effect", length=length@entry=0x0) at 
filter_glsl_manager.cpp:280
#5  0x00007fffe88b613e in GlslManager::get_effect 
(service=service@entry=0x7fffc4406520, frame=frame@entry=0x7fffc42bad90)
    at filter_glsl_manager.cpp:306
#6  0x00007fffe88b74b6 in build_fingerprint (service=0x7fffc4406520, 
frame=frame@entry=0x7fffc42bad90, 
    fingerprint=fingerprint@entry=0x7fffdbc07c90) at 
filter_movit_convert.cpp:118
#7  0x00007fffe88b7522 in build_fingerprint (service=0x7b6300, 
frame=frame@entry=0x7fffc42bad90, fingerprint=fingerprint@entry=0x7fffdbc07c90)
    at filter_movit_convert.cpp:122
#8  0x00007fffe88b7522 in build_fingerprint (service=0x7d0e40, 
frame=frame@entry=0x7fffc42bad90, fingerprint=fingerprint@entry=0x7fffdbc07c90)
    at filter_movit_convert.cpp:122
#9  0x00007fffe88b7522 in build_fingerprint (service=service@entry=0x7e6140, 
frame=frame@entry=0x7fffc42bad90, 
    fingerprint=fingerprint@entry=0x7fffdbc07c90) at 
filter_movit_convert.cpp:122
#10 0x00007fffe88b8a33 in finalize_movit_chain (frame=0x7fffc42bad90, 
leaf_service=0x7e6140) at filter_movit_convert.cpp:227
#11 convert_image (frame=0x7fffc42bad90, image=0x7fffdbc07ec8, format=0x83038c, 
output_format=mlt_image_glsl_texture)
    at filter_movit_convert.cpp:481
#12 0x00007ffff7bb640f in mlt_frame_get_image (self=self@entry=0x7fffc42bad90, 
buffer=buffer@entry=0x7fffdbc07ec8, 
    format=format@entry=0x83038c, width=width@entry=0x7fffdbc07ea8, 
height=height@entry=0x7fffdbc07eac, writable=writable@entry=0)
    at mlt_frame.c:586
#13 0x00007ffff7bcb8bd in producer_get_image (self=self@entry=0x7fffc42bc770, 
buffer=buffer@entry=0x7fffdbc07ec8, 
    format=format@entry=0x83038c, width=width@entry=0x7fffdbc07ea8, 
height=height@entry=0x7fffdbc07eac, writable=writable@entry=0)
    at mlt_tractor.c:273
#14 0x00007ffff7bb62e7 in mlt_frame_get_image (self=self@entry=0x7fffc42bc770, 
buffer=buffer@entry=0x7fffdbc07ec8, 
    format=format@entry=0x83038c, width=width@entry=0x7fffdbc07ea8, 
height=height@entry=0x7fffdbc07eac, writable=writable@entry=0)
    at mlt_frame.c:580
#15 0x00007ffff7bc912d in consumer_read_ahead_thread (arg=0x9c3fc0) at 
mlt_consumer.c:782




> 
> > https://github.com/mltframework/mlt/commit/3f84fe14c06956b5092c257fd27da49
> > 0565566e5
> > 
> > Removing:
> > 
> > *format = mlt_image_none;
> > 
> > in filter_movit_crop.cpp seems to have some bad side effects. I was able
> > to fix the leak by changing mlt_frame.c and adding some checks for
> > mlt_image_glsl like:
> > 
> > (...)
> > 
> > -                       if ( self->convert_image && requested_format !=
> > mlt_image_none ) +                       if ( self->convert_image &&
> > requested_format != mlt_image_none && requested_format != mlt_image_glsl
> > ) {
> > 
> >                                 self->convert_image( self, buffer, format,
> >                                 requested_format );
> > 
> > (...)
> > 
> > The full patch is attached.
> 
> This change looks incompatible with filter movit.convert, which does
> need to be called when requested_format == glsl.
> 
> > I also have a patch ready for the slowmotion producer
> > (producer_framebuffer.c) that makes it handle formats mlt_image_none and
> > mlt_image_glsl so that when it is asked for these formats, it queries the
> > original avformat producer for its format to set it. I will submit a pull
> > request for it.
> > 
> > Comments welcome,
> > 
> > regards
> > jb


------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to