I am trying to render a GStreamer pipeline running on top of a XUL window.
For this I wrote an XPCOM plugin. A XPCOM plugin is basically a dll file that gets loaded by the Gecko engine. My plugin links with GStreamer and as a consequence it depends on many other GStreamer plugins (also dll files).
Invoking GStreamer code (for example a simple function like gst_pipeline_new
) causes the application to crash. More specifically it freezes and hangs in glib consuming an entire CPU core (50% of total CPU):
Would someone be willing to help me figure out what's going wrong?
Edit
A few remarks:
- Stand-alone GStreamer projects on Windows work fine.
- The XUL plugin works fine as well (as long as I don't make any GStreamer calls).
- From within the XUL plugin I can call a simple glib functions like g_strndup without any problems.
- Calling GStreamer functions from within the plugin crashes the app.
This code can reproduce the problem. (I'm not sure if it's helpful though..)
The plugin .idl file defines the property videoWindow
:
#include "nsISupports.idl"
interface nsIDOMXULElement;
[scriptable, uuid(BFE3F1BF-1C7B-4da2-8EAB-12F7683FAF71)]
interface IVideo : nsISupports
{
attribute nsIDOMXULElement videoWindow;
};
Its implementation can reproduce the problem:
NS_IMETHODIMP Video::SetVideoWindow(nsIDOMXULElement * inXULVideoWindow)
{
GstElement * pipeline = gst_pipeline_new("test"); // freezes here
return NS_OK;
}
Edit
Problem is fixed. See my own answer to this post.