GNOME Bugzilla – Bug 796890
d3d: d3d_wnd_proc (d3dhelper.c) raises an exception because sink is NULL at LOCK_SINK (sink);
Last modified: 2018-11-03 14:28:50 UTC
At the function *d3d_wnd_proc* in the *d3dhelper.c* file, *GetProp* returns NULL at this code: GstD3DVideoSink *sink = (GstD3DVideoSink *) GetProp (hWnd, TEXT ("GstD3DVideoSink")); Then it calls LOCK_SINK(NULL) here: LOCK_SINK (sink); proc = sink->d3d.orig_wnd_proc; UNLOCK_SINK (sink); And the program crashes at function *g_rec_mutex_get_impl* in the *gthread-win32.c* file.
Can you provide a backtrace of when this happens? Or do you know what the code path is so that it ends up being NULL there?
Created attachment 373224 [details] D3d console error
This is a crash that happens eventually and it's not being easy to reproduce it. I'm using gstreamer along with Qt, so I'm passing the Qt window id to the function gst_video_overlay_set_window_handle. This is the call stack when the error occurs: > [Inline Frame] glib-2.0-0.dll!g_rec_mutex_get_impl(_GRecMutex *) Line 131 C glib-2.0-0.dll!g_rec_mutex_lock(_GRecMutex * mutex) Line 159 C gstd3d.dll!d3d_wnd_proc(HWND__ * hWnd, unsigned int message, unsigned int wParam, long lParam) Line 2004 C [External Code] [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] qwindowsd.dll!QWindowsWindow::show_sys() Line 1475 C++ qwindowsd.dll!QWindowsWindow::setVisible(bool visible) Line 1301 C++ Qt5Guid.dll!QWindowPrivate::setVisible(bool visible) Line 403 C++ Qt5Widgetsd.dll!QWidgetWindow::setNativeWindowVisibility(bool visible) Line 206 C++ Qt5Widgetsd.dll!QWidgetPrivate::show_sys() Line 8120 C++ Qt5Widgetsd.dll!QWidgetPrivate::show_helper() Line 8043 C++ Qt5Widgetsd.dll!QWidget::setVisible(bool visible) Line 8337 C++ Qt5Widgetsd.dll!QWidget::show() Line 7888 C++ The QWidget is the window used to render the video. I'm using two pipelines to capture two cameras, this looks like a race condition to me. I've added the console output as an attachment. Note that I've added this debug message: GST_DEBUG_OBJECT(sink, "SetProp handle:%p", sink->d3d.window_handle); just before calling the function SetProp (at d3d_window_wndproc_set function) and it is calling only for the first video, but not for the second. So when we try to recover it with GetProp, it returns NULL.
Created attachment 373232 [details] D3d console error with a single pipeline I've just tested it with a single pipeline, and it seems to be a race condition between the main thread and the queue thread of the pipeline. The simplified version of the pipeline is: ksvideosrc ! capsfilter ! tee name=t t. ! queue ! videoconvert ! d3dvideosink I think adding a simple condition variable to control the order of read/write of "GstD3DVideoSink" prop of the window would suffice.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/757.