[softhddevice-Plugin] Segfault bei offenem OSD und einem resize des Fensters

  • It seems that osdtest does not call VideoOSDInit bevor changing the size of the Images. . But it changes the Area above the currend OSD Size.

    Code
    1. set osd 1920 x 1080... debug in VideoOSDInit
    2. ==> Construct OsdImage...
    3. start readOsdUpdate
    4. Image size 100x100
    5. OsdImage readOsdUpdate, get scale context
    6. OsdImage readOsdUpdate, scale image
    7. ==> OsdImage Show()
    8. ==> Display
    9. Area size set to 0:0 - 3839:2159 <------------- Area ist set above osd size. That will crash of course.
  • Hi,

    it did not solve the issue but changing the initialization order may make sense in softhdcuvid

    https://github.com/pesintta/vd…231787538e98635403c891059

    with the patch I get

    CU

    9000h

    Es ist eagl in wlehcer Reiehnfogle die Bchustebaen in Woeretrn vokrmomen. Huapstache der estre und leztte Bchustbae sitmmen.

  • Code
    1. //posd = (unsigned char *)calloc((OsdWidth + 1) * (OsdHeight + 1) * 4, 1);
    2. posd = (unsigned char *)calloc((4096 + 1) * (2160 + 1) * 4, 1);

    If you change the calloc to the maximum size then osdtest runs ok. But the Images are wrongly scaled because the Images are in the wrong size.


    So the Images need to be within the OSD size,

  • Hi,

    hmm strange, with the change from jojo61 it did not crash and displayed correct.

    CU

    9000h

    Es ist eagl in wlehcer Reiehnfogle die Bchustebaen in Woeretrn vokrmomen. Huapstache der estre und leztte Bchustbae sitmmen.

  • I have changed both osdtest and main plugin and introduced the define SET_AREA_VERY_EARLY in osdimage.c and cefhbbtvpage.c.

    If it is defined, the area will be set to the (hopefully) maximum value, but if undefined, the call of SetArea happens after determination of the OSD size and SetArea uses the real OSD size.

    Softhdcuvid crashes directly after a window resize - if SET_AREA_VERY_EARLY is not defined. With the already mentioned segfault while doing cOglFont::Cleanup.

    Softhddevice (with my patches and known flaws) works nearly as desired without any crash.


    I now remember why i set the area size very early. But because at least one plugin works i think i will changed it again to set the area after knowing the real OSD size.


    Zabrimus

  • Hi,


    i have tested both changing the posd calloc

    and moving VideoOsdInit(); as mentioned by 9000h (#23).

    And the result is the same. Directly resizing the VDR window (while channel information or main menu is visible) leads to a stopped VDR.

    The exactly same result i got with softhddevice.


    The only plugins started are softhdcuvid and satip. No other skin or other plugins.


    Because i'm probably the only one with this problem, it can be either, i'm the only one who resizes the window very early or my installation is somehow different to all other ones.


    I started the debugger in Clion and try to show the details:


    Stacktrace is:


    Let's go through the stacktrace:

    1. cThread::StartThread thread.c:293


    C
    1. void *cThread::StartThread(cThread *Thread)
    2. {
    3. ...
    4. Thread->Action(); // Line 293
    5. ...
    6. }


    2. cOglThread::Action openglosd.cpp:1763


    3. cOglThread::Cleanup openglosd.cpp:1879

    C
    1. void cOglThread::Cleanup(void)
    2. {
    3. ...
    4. cOglFont::Cleanup(); // Line 1879
    5. ...
    6. }


    4. cOglFont::Cleanup openglosd.cpp:400

    Code
    1. void cOglFont::Cleanup(void)
    2. {
    3. ...
    4. if (FT_Done_FreeType(ftLib)) // Line 400
    5. esyslog("failed to deinitialize FreeType library!");
    6. ...
    7. }


    I assume that Running() in 2. return false and then the thread starts and immediately tries to cleanup itself. I've added an additional output statement to verify my assumption. And yes, Running() returns false.

    And one additional observation from the above syslog:

    May 15 14:08:07 xxx vdr: [17451] oglThread thread started (pid=17383, tid=17451, prio=high)

    May 15 14:08:07 xxx vdr: [17429] [softhddev]stopping OpenGL Worker Thread

    May 15 14:08:07 xxx vdr: [17451] [softhddev]OpenGL Context initialized


    The thread 17429 is beginning to stop itself after the other thread 17451 has been started. And i assume some global or static variables will be overwritten.


    Zabrimus


    ps: Sorry for the long post. I will try to stop myself writing too much nonsense.

  • I wonder why it is crashing in FT_Done_Freetype. HOw did you test this ? Can I test this with osdtest or do I need to install your hbbtv plugin ?


    And why do you need to resize the OSD after all ? To my understanding, the OSD needs only be resized when I change the windows size.

    So in fullscreenmode (as it usually is) there is no need to resize the OSD at all.

  • This is a special use case and happens often while developing. There I often change the VDR window either to fullscreen or i resize the window to see other more important windows. If i don't change the window size at all, then everything works as desired. Especially the switching to fullscreen happens so often unintentionally because it is only a click into the VDR window. If then VDR crash, although i wanted to do something else, it's a little bit annoying.


    It can easily reproduced by opening any VDR menu (e.g. main menu, channel list, program, ... it doesn't matter) and then while resizing the VDR window, the error occurs. The problem does not depends on any plugin at all. The plugin osdtest is more useful to test if resizing the OSD to the same size as the VDR window, works.