[SOLVED] Framerate doubling - crash?

This forum is about all development around libVLC.
Technologicat
Blank Cone
Blank Cone
Posts: 53
Joined: 13 Dec 2010 02:12
VLC version: 1.1.5, 1.2-git
Operating System: Mac OS, Linux

[SOLVED] Framerate doubling - crash?

Postby Technologicat » 03 Jan 2011 19:52

Hi all,

After developing an IVTC filter, I thought I'd have a go at another kind of deinterlacer... that doesn't deinterlace at all :)

That is, I'm simulating an old CRT in software. If we don't mind that the pixel positions don't exactly match between an LCD display and a CRT TV, this can be done with a framerate doubler, which dims the "old" field (simulating phosphor light output decay) while the "new" one is being rendered. With a two-frame cache, ComposeFrame() from my IVTC filter, and a trivial luma dimmer (which I still need to MMX), this was easy.

And it actually works. The output looks pretty good, no interlacing artifacts are visible and 60 fps camera pans look very smooth. Note that for pure 24 fps NTSC telecined progressive material, IVTC is better, while this "CRT simulation" looks better for hybrid 24/60 fps (because it won't cause a framerate mismatch).

This brings me to the topic of this post.

I'm getting crashes during playback whenever I activate a framerate doubling deinterlacer. It's not only my new filter - it happens e.g. with "Yadif2x" and "Bob", too. The crashes occur randomly, but more often if I seek around in the video.

This is what gdb gives me:

Code: Select all

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb1fabb70 (LWP 15184)] 0xb7f6b2bc in video_format_CopyCrop (p_dst=0x0, p_src=0x8419b08) at ../../src/misc/es_format.c:212 212 p_dst->i_x_offset = p_src->i_x_offset; (gdb) backtrace #0 0xb7f6b2bc in video_format_CopyCrop (p_dst=0x0, p_src=0x8419b08) at ../../src/misc/es_format.c:212 #1 0xb7f45418 in VideoFormatCopyCropAr (vout=<value optimized out>, now=<value optimized out>, deadline=0xb1fab360) at ../../src/video_output/video_output.c:98 #2 ThreadDisplayRenderPicture (vout=<value optimized out>, now=<value optimized out>, deadline=0xb1fab360) at ../../src/video_output/video_output.c:938 #3 ThreadDisplayPicture (vout=<value optimized out>, now=<value optimized out>, deadline=0xb1fab360) at ../../src/video_output/video_output.c:1048 #4 0xb7f4620c in ThreadManage (object=0x84148d4) at ../../src/video_output/video_output.c:1060 #5 Thread (object=0x84148d4) at ../../src/video_output/video_output.c:1488 #6 0xb7e33955 in start_thread (arg=0xb1fabb70) at pthread_create.c:300 #7 0xb7daee7e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
So, something is passing a null p_dst to video_format_CopyCrop(). Everything looks all right on the deinterlacer end, and it only happens when a framerate doubling deinterlacer is enabled.

Also, this same crash happens immediately (at the third frame after opening a stream) if a framerate doubling deinterlacer is chosen as the default in the options.

The version I have is 1.2-git from around mid-December.

I'd like to contribute the code for my new filter, but also to get this working to actually make it useful.

Anyone else seen this problem? Any ideas?
Last edited by Technologicat on 04 Jan 2011 23:41, edited 1 time in total.

Technologicat
Blank Cone
Blank Cone
Posts: 53
Joined: 13 Dec 2010 02:12
VLC version: 1.1.5, 1.2-git
Operating System: Mac OS, Linux

Re: Framerate doubling - crash?

Postby Technologicat » 04 Jan 2011 00:02

Update:

I debugged this a bit. Fixed.

The function ThreadDisplayRenderPicture() (in src/video_output/video_output.c) attempts to generate its direct buffer, and this sometimes fails. Sure enough, gdb pointed to the last line of the following snippet (at this point, "direct" is a new local variable initialized as NULL):

Code: Select all

if (vout->p->is_decoder_pool_slow) { direct = picture_pool_Get(vout->p->display_pool); if (direct) picture_Copy(direct, render); picture_Release(render); } else { direct = render; } VideoFormatCopyCropAr(&direct->format, &filtered->format);
which will crash if direct == NULL. If vout->p->is_decoder_pool_slow is true, but for some reason there is no picture in the display pool, this can happen.

So, I changed my copy to:

Code: Select all

if (vout->p->is_decoder_pool_slow) { direct = picture_pool_Get(vout->p->display_pool); if (direct) picture_Copy(direct, render); picture_Release(render); } else { direct = render; } if(direct) VideoFormatCopyCropAr(&direct->format, &filtered->format); else msg_Warn( vout, "ThreadDisplayRenderPicture(): direct is NULL, aborting" );
and sure enough, I get the occasional warning I just added, but the crashing stopped. This error occurs very rarely, but when it does, there can be a burst of them. In one debug test I got 14 in a row.

(The original code does indeed abort after this if direct == NULL, so I suspect the above line has just slipped the original dev's attention.)

Any VLC devs willing to comment, or to take it from here? :)

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Framerate doubling - crash?

Postby Rémi Denis-Courmont » 04 Jan 2011 21:59

Better post on vlc-devel. Many devs don't read the forums.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Technologicat
Blank Cone
Blank Cone
Posts: 53
Joined: 13 Dec 2010 02:12
VLC version: 1.1.5, 1.2-git
Operating System: Mac OS, Linux

Re: Framerate doubling - crash?

Postby Technologicat » 04 Jan 2011 23:36

Better post on vlc-devel. Many devs don't read the forums.
Done. Posted a description of the problem and my solution. Thanks for the tip.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Framerate doubling - crash?

Postby Jean-Baptiste Kempf » 05 Jan 2011 17:22

Better post on vlc-devel. Many devs don't read the forums.
s/Many/Most
:D
Although I have to say that this subforum is of way much higher quality than the rest.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

Technologicat
Blank Cone
Blank Cone
Posts: 53
Joined: 13 Dec 2010 02:12
VLC version: 1.1.5, 1.2-git
Operating System: Mac OS, Linux

Re: Framerate doubling - crash?

Postby Technologicat » 05 Jan 2011 20:39

s/Many/Most
:D
I see :)

Technologicat
Blank Cone
Blank Cone
Posts: 53
Joined: 13 Dec 2010 02:12
VLC version: 1.1.5, 1.2-git
Operating System: Mac OS, Linux

Re: [SOLVED] Framerate doubling - crash?

Postby Technologicat » 05 Jan 2011 22:30

Final update:

Rémi has fixed the crash properly in today's 1.2-git. This issue can be considered closed.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 3 guests