Movit crash when moving cursor over transition
In Kdenlive master and MLT master with movit 1.6.3. See attached video for how I reproduced.
Thread 993 (Thread 0x7fff44d36640 (LWP 15952)): #0 0x00000000400aff31 in () #1 0x00007fff002a1a90 in () #2 0x00007fff00fe5610 in () #3 0x00007fff44d35050 in () #4 0x00000000000002da in () #5 0x00007fffe7b6b926 in () at /usr/lib/libnvidia-glcore.so.450.66 #6 0x00007fffe7b7652a in () at /usr/lib/libnvidia-glcore.so.450.66 #7 0x00007fffe7ce845b in () at /usr/lib/libnvidia-glcore.so.450.66 #8 0x00007fffe7cba64f in () at /usr/lib/libnvidia-glcore.so.450.66 #9 0x00007fffe7cbbf87 in () at /usr/lib/libnvidia-glcore.so.450.66 #10 0x00007fffe7cca8d4 in () at /usr/lib/libnvidia-glcore.so.450.66 #11 0x00007fffcbd663df in movit::FlatInput::set_gl_state(unsigned int, std::__cxx11::basic_string, std::allocator > const&, unsigned int*) (this=0x617000588380, glsl_program_num= , prefix=..., sampler_num=0x7fff44d355d0) at flat_input.cpp:149 internal_format = format = 6407 __PRETTY_FUNCTION__ = "virtual void movit::FlatInput::set_gl_state(GLuint, const string&, unsigned int*)" #12 0x00007fffcbd54717 in movit::EffectChain::execute_phase(movit::Phase*, std::map<:phase unsigned int std::less>, std::allocator<:pair const unsigned int> > > const&, std::vector<:effectchain::destinationtexture std::allocator> > const&, std::set<:phase std::less>, std::allocator<:phase> >*) (this=this@entry=0x6120008d5140, phase=phase@entry=0x616001367d80, output_textures=std::map with 0 elements, destinations=std::vector of length 0, capacity 0, generated_mipmaps=generated_mipmaps@entry=0x7fff44d356f0) at /usr/include/c++/10.1.0/bits/stl_tree.h:350 node = 0x60d0006d3a70 old_sampler_num = i = 5 __PRETTY_FUNCTION__ = "void movit::EffectChain::execute_phase(movit::Phase*, const std::map<:phase unsigned int>&, const std::vector<:effectchain::destinationtexture>&, std::set<:phase>*)" instance_program_num = 48 fbo = 0 sampler_num = 4 #13 0x00007fffcbd55266 in movit::EffectChain::render(unsigned int, std::vector<:effectchain::destinationtexture std::allocator> > const&, unsigned int, unsigned int, unsigned int, unsigned int) (this=0x6120008d5140, dest_fbo=13, destinations=std::vector of length 0, capacity 0, x=0, y=0, width=1920, height=1080) at effect_chain.cpp:2109 phase = 0x616001367d80 last_phase = needs_srgb = phase_destinations = std::vector of length 0, capacity 0 phase_num = 0 __PRETTY_FUNCTION__ = "void movit::EffectChain::render(GLuint, const std::vector<:effectchain::destinationtexture>&, unsigned int, unsigned int, unsigned int, unsigned int)" final_srgb = current_srgb = false generated_mipmaps = std::set with 0 elements output_textures = std::map with 0 elements ref_counts = std::map with 0 elements num_phases = 1 #14 0x00007fffcbd56075 in movit::EffectChain::render_to_fbo(unsigned int, unsigned int, unsigned int) (this=this@entry=0x6120008d5140, dest_fbo=13, width= , width@entry=1920, height= , height@entry=1080) at /usr/include/c++/10.1.0/bits/stl_vector.h:97 x = y = #15 0x00007fffd0efe0bb in GlslManager::render_frame_texture(movit::EffectChain*, mlt_frame_s*, int, int, unsigned char**) (this=0x6080000e5fa0, chain=chain@entry=0x6120008d5140, frame=frame@entry=0x6080008c87a0, width=width@entry=1920, height=height@entry=1080, image=image@entry=0x7fff44d35b58) at filter_glsl_manager.cpp:434 texture = 0x603001aef5a0 fbo = 13 sync = #16 0x00007fffd0f018bf in movit_render (image=0x7fff44d35b58, height=1080, width=1920, output_format=mlt_image_glsl_texture, format=0x61400192f04c, frame=0x6080008c87a0, chain=0x6120008d5140) at filter_movit_convert.cpp:458 glsl = error = leaf_service = 0x60c006687700 chain = 0x60d000b80d20 properties = 0x6080008c87a0 glsl = error = 0 width = 1920 height = 1080 #17 movit_render (image=0x7fff44d35b58, height=1080, width=1920, output_format=mlt_image_glsl_texture, format=0x61400192f04c, frame=0x6080008c87a0, chain=0x6120008d5140) at filter_movit_convert.cpp:448 leaf_service = 0x60c006687700 chain = 0x60d000b80d20 properties = 0x6080008c87a0 glsl = error = 0 width = 1920 height = 1080 #18 convert_image(mlt_frame, uint8_t**, mlt_image_format*, mlt_image_format) (frame=0x6080008c87a0, image=0x7fff44d35b58, format=0x61400192f04c, output_format=mlt_image_glsl_texture) at filter_movit_convert.cpp:609 leaf_service = 0x60c006687700 chain = 0x60d000b80d20 properties = 0x6080008c87a0 glsl = error = 0 width = 1920 height = 1080 #19 0x00007ffff7114554 in mlt_frame_get_image (self=self@entry=0x6080008c87a0, buffer=buffer@entry=0x7fff44d35b58, format=format@entry=0x61400192f04c, width=width@entry=0x7fff44d35b44, height=height@entry=0x7fff44d35b48, writable=writable@entry=0) at mlt_frame.c:626 properties = 0x6080008c87a0 get_image = 0x7fffd0f073c0 requested_format = error = #20 0x00007ffff712d32e in producer_get_image (self=self@entry=0x6080009b7ea0, buffer=buffer@entry=0x7fff44d35b58, format=format@entry=0x61400192f04c, width=width@entry=0x7fff44d35b44, height=height@entry=0x7fff44d35b48, writable=writable@entry=0) at mlt_tractor.c:371 data = 0x0 size = 0 properties = 0x6080009b7ea0 frame = 0x6080008c87a0 frame_properties = 0x6080008c87a0 i = #21 0x00007ffff71144f2 in mlt_frame_get_image (self=self@entry=0x6080009b7ea0, buffer=buffer@entry=0x7fff44d35b58, format=format@entry=0x61400192f04c, width=width@entry=0x7fff44d35b44, height=height@entry=0x7fff44d35b48, writable=writable@entry=0) at mlt_frame.c:620 properties = 0x6080009b7ea0 get_image = 0x7ffff712d1b0 requested_format = error = 0 #22 0x00007ffff712a50c in consumer_read_ahead_thread (arg= ) at mlt_consumer.c:911 _mlt_log_timings_begin = 1600108079685076 _mlt_log_timings_end = buffer = 1 time_current = self = priv = 0x61400192f040 properties = width = 1920 height = 1080 video_off = preview_off = preview_format = samples = 2002 audio = 0x6250005cf910 audio_off = frame = 0x6080009b7ea0 image = 0x60c006687700 "" ante = {tv_sec = 1600108079, tv_usec = 679715} count = skipped = time_process = skip_next = pos = start_pos = 1305 last_pos = frame_duration = drop_max = #23 0x000055555655cbc1 in RenderThread::run() (this=0x60400078fb50) at /home/farid/kdenlive/src/monitor/glwidget.cpp:1448 #24 0x00007ffff21f1e8f in () at /usr/lib/libQt5Core.so.5 #25 0x00007ffff1dd63e9 in start_thread () at /usr/lib/libpthread.so.0 #26 0x00007ffff1cdf293 in clone () at /usr/lib/libc.so.6

sorry for the late reply, but could you try running it from a terminal and post the output from there as well? (I'll try to reproduce it myself later.)
sorry for the late reply, but could you try running it from a terminal and post the output from there as well? (I'll try to reproduce it myself later.)
So now it crashes only when enabling/disabling the lift/gama/gain filter that is applied to the clip. And that also seems to be the cause of the artifacts. See here:
kcrash-report.txt terminal.txt

annoyingly deep in the nvidia driver...
but looks like it might be mlt not either deleting or recreating the lift/gamma/gain movit effect (hence the artifacts, and eventual crash)
Seems to be the same root cause as in https://github.com/mltframework/mlt/issues/576
Which seems to be the mlt_movit_convert filter, which is supposed to convert the image format from whatever comes earlier in the MLT chain to what movit requires.
And since the other report is with an image, and the crash happens in the flat input converter, it's probably when there's RGB input. And there's some TODO comments in filter_movit_convert when there's rgb input.
edit: some pure speculation, but it might be when the input format changes, I'm fairly certain that mlt_movit_input doesn't send the right data to movit, at least.
edit2: more weird, output_textures in movit is empty? it should assert if it doesn't have an output, but still...
edit3: a lot of the code looks suspect to me, but I think this might solve it:
diff --git a/src/modules/opengl/filter_movit_convert.cpp b/src/modules/opengl/filter_movit_convert.cpp
index 3d06d618..10405787 100644
--- a/src/modules/opengl/filter_movit_convert.cpp
+++ b/src/modules/opengl/filter_movit_convert.cpp
@@ -594,6 +594,7 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo
*image = GlslManager::get_input_pixel_pointer( producer, frame );
*format = input->get_format();
delete input;
+ GlslManager::set_input( producer, frame, nullptr );
GlslManager::get_instance()->unlock_service( frame );
return convert_on_cpu( frame, image, format, output_format );
}
Seems to be the same root cause as in #576
Which seems to be the mlt_movit_convert filter, which is supposed to convert the image format from whatever comes earlier in the MLT chain to what movit requires.
And since the other report is with an image, and the crash happens in the flat input converter, it's probably when there's RGB input. And there's some
TODOcomments in filter_movit_convert when there's rgb input.edit: some pure speculation, but it might be when the input format changes, I'm fairly certain that mlt_movit_input doesn't send the right data to movit, at least.
edit2: more weird, output_textures in movit is empty? it should assert if it doesn't have an output, but still...
edit3: a lot of the code looks suspect to me, but I think this might solve it:
diff --git a/src/modules/opengl/filter_movit_convert.cpp b/src/modules/opengl/filter_movit_convert.cpp index 3d06d618..10405787 100644 --- a/src/modules/opengl/filter_movit_convert.cpp +++ b/src/modules/opengl/filter_movit_convert.cpp @@ -594,6 +594,7 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo *image = GlslManager::get_input_pixel_pointer( producer, frame ); *format = input->get_format(); delete input; + GlslManager::set_input( producer, frame, nullptr ); GlslManager::get_instance()->unlock_service( frame ); return convert_on_cpu( frame, image, format, output_format ); }
sorry for the late reply, i am getting this:
==> Starting prepare()...
(Patch is indented 2 spaces.)
patching file src/modules/opengl/filter_movit_convert.cpp
(Patch is indented 2 spaces.)
patching file src/modules/opengl/filter_movit_convert.cpp
Hunk #1 succeeded at 598 (offset 4 lines).
(Patch is indented 2 spaces.)
patching file src/modules/opengl/filter_movit_convert.cpp
Hunk #1 FAILED at 594.
1 out of 1 hunk FAILED -- saving rejects to file src/modules/opengl/filter_movit_convert.cpp.rej
==> ERROR: A failure occurred in prepare().
Aborting...
hmm, on latest git master? and if so, from the output I guess this?: https://aur.archlinux.org/packages/mlt-git
hmm, on latest git master? and if so, from the output I guess this?: https://aur.archlinux.org/packages/mlt-git
Yup, using latest git master. Here is my PKGBUILD.txt
you can probably drop the other patches, that might be what's messing it up.
fwiw, the only thing I do is to add a line that makes sure the GlslManager knows that it doesn't have an input anymore (since it got deleted).
you can probably drop the other patches, that might be what's messing it up.
fwiw, the only thing I do is to add a line that makes sure the GlslManager knows that it doesn't have an input anymore (since it got deleted).
Dropped the other two paches, it built, but now i get this crash: gdb-movit.txt
Is this still reproducible ?