The CDB process terminated. Using libvlc and opencv on QTCreator 3.10



  • There's an error in the title. Should say "QTcreator 4.1", but I don't seem able to change it.

    I'm having the weirdest bug in QTCreator and I can not find out why or how it's happening.

    Running QTCreator 4.1.0, Based on QT 5.7.0.
    Compiler: MSVC 2015 x64.
    External libraries: Opencv 3.10 and LibVLC 2.2.4 (both 64 bit. Using 32 bit compiler with 32 bit libraries creates the same error).

    The code I'm trying to make work is from an example I found on a forum. It fetches a picture from an IP camera with LibVLC and transfers it to a OpenCV Mat (I'm using QTCreator to do this because I'm later going to show the picture in a QT frontend).

    The program compiles fine, but crashes immediately on startup with the debug error "The CDB process terminated."

    Here's the code that creates the crash 100% of the time (Runs fine in Visual Studio):

    #include <Windows.h>
    #include <opencv\highgui.h>
    #include <opencv\cv.h>
    #include <opencv2\opencv.hpp>
    #include "vlc/vlc.h"
    
    using namespace cv;
    
    struct ctx
    {
    Mat* image;
    HANDLE mutex;
    uchar* pixels;
    };
    // define output video resolution
    #define VIDEO_WIDTH     1920
    #define VIDEO_HEIGHT    1080
    
    void *lock(void *data, void**p_pixels)
    {
    struct ctx *ctx = (struct ctx*)data;
    
    WaitForSingleObject(ctx->mutex, INFINITE);
    
    // pixel will be stored on image pixel space
    *p_pixels = ctx->pixels;
    
    return NULL;
    
    }
    
    void display(void *data, void *id) {
    (void)data;
    assert(id == NULL);
    }
    
    void unlock(void *data, void *id, void *const *p_pixels) {
    
    // get back data structure 
    struct ctx *ctx = (struct ctx*)data;
    
    /* VLC just rendered the video, but we can also render stuff */
    // show rendered image
    imshow("test", *ctx->image);
    
    ReleaseMutex(ctx->mutex);
    }
    
    int main()
    {
    // VLC pointers
    libvlc_instance_t *vlcInstance;
    libvlc_media_player_t *mp;
    libvlc_media_t *media;
    
    const char * const vlc_args[] = {
    	"-I", "dummy", // Don't use any interface
    	"--ignore-config", // Don't use VLC's config
    	"--extraintf=logger", // Log anything
    	"--verbose=2", // Be much more verbose then normal for debugging purpose
    };
    
    vlcInstance = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args);
    
    // Read a distant video stream
    media = libvlc_media_new_location(vlcInstance, "rtsp://root:root@10.11.12.13:1234/videoinput_1/h264_1/media.stm");
    
    mp = libvlc_media_player_new_from_media(media);
    
    libvlc_media_release(media);
    
    struct ctx* context = (struct ctx*)malloc(sizeof(*context));
    context->mutex = CreateMutex(NULL, FALSE, NULL);
    
    context->image = new Mat(VIDEO_HEIGHT, VIDEO_WIDTH, CV_8UC3);
    context->pixels = (unsigned char *)context->image->data;
    // show blank image
    imshow("test", *context->image);
    
    libvlc_video_set_callbacks(mp, lock, unlock, display, context);
    libvlc_video_set_format(mp, "RV24", VIDEO_WIDTH, VIDEO_HEIGHT, VIDEO_WIDTH * 24 / 8); // pitch = width * BitsPerPixel / 8
    
    
    int ii = 0;
    int key = 0;
    while (key != 27)
    {
    	ii++;
    	if (ii > 5)
    	{
    		libvlc_media_player_play(mp);
    	}
    	float fps = libvlc_media_player_get_fps(mp);
    	printf("fps:%f\r\n", fps);
    	key = waitKey(30); // wait 100ms for Esc key
        }
    
        libvlc_media_player_stop(mp);
    
    
        return 0;
    }
    

    Bear in mind, program doesn't actually have to run the code to crash. Even if it just sits in a unused method, it still crashes immediately on startup.

    Here's the bizarre part: If I comment out the "broken code" from the program, the error is still there. I remove the code completely (with ctrl+z to a point before I added it), and the error is still there. I remove the includes, still error. The only way I can find to run the program after getting this error is to remove all broken code and associated libraries, create a different type of build error, and that somehow resets the debugger enough to run the program again. Even restarting the program or rebooting the computer doesn't work

    From a different forum, I found a tip to add cdb.exe manually in tools-options-Debugger-CDB:
    C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe

    Having done that, the debugger (without an error this time) locks itself on startup (refuses to be closed), while running the application without it one produces a regular crash.

    With that, I am out of ideas. Anyone else?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.