After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 796890 - d3d: d3d_wnd_proc (d3dhelper.c) raises an exception because sink is NULL at LOCK_SINK (sink);
d3d: d3d_wnd_proc (d3dhelper.c) raises an exception because sink is NULL at L...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.14.2
Other Windows
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-07-28 23:09 UTC by Marcos Kintschner
Modified: 2018-11-03 14:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
D3d console error (21.10 KB, text/plain)
2018-07-30 20:24 UTC, Marcos Kintschner
Details
D3d console error with a single pipeline (10.36 KB, text/plain)
2018-07-31 20:23 UTC, Marcos Kintschner
Details

Description Marcos Kintschner 2018-07-28 23:09:58 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.
Comment 1 Sebastian Dröge (slomo) 2018-07-30 06:44:12 UTC
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?
Comment 2 Marcos Kintschner 2018-07-30 20:24:07 UTC
Created attachment 373224 [details]
D3d console error
Comment 3 Marcos Kintschner 2018-07-30 20:24:33 UTC
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.
Comment 4 Marcos Kintschner 2018-07-31 20:23:53 UTC
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.
Comment 5 GStreamer system administrator 2018-11-03 14:28:50 UTC
-- 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.