gstreamer pipeline creation fails - in case of concurrent initialization
pawan.ec
pawan.ec at gmail.com
Fri May 13 13:23:16 UTC 2016
code which i am using:
below function runs in two different thread in two different object. ANd on
the basis of the component type we decide that which pipeline to create.
Ias::IasResult initGst()
{
setenv("GST_REGISTRY_UPDATE", "no", 1);
setenv("GST_REGISTRY", "/opt/jlr/share/ngi_early_app/registry.i686.bin",
1);
GstElement *appsink = NULL;
GstElement *demux = NULL;
if (mComponentType == eVideo)
{
g_set_application_name ("early splash video");
}
else if(mComponentType == eImage)
{
g_set_application_name ("early Image upper");
}
else if (mComponentType == eImageLowerScreen)
{
g_set_application_name ("early Image lower");
}
if (IAS_SUCCEEDED(res))
{
GError *err;
gboolean const ret = gst_init_check(NULL, NULL, &err);
if (!ret)
{
return ;
}
}
if (IAS_SUCCEEDED(res))
{
if(mComponentType == eVideo)
{
/* Pipeline is as follows:
* /---> queue ---> vp8dec ---> appsink
// videopart
* filesrc --> matrioskademux
* \---> queue ---> vorbisdec --->
audioconvert ---> audioresample ---> autoaudiosink
*
* For now, the audio link will be not be
supported
*
*/
mPipeline = gst_pipeline_new ("splash-video");
GstElement *filesrc = gst_element_factory_make("filesrc", "videosrc");
if (!filesrc)
{
EAPP_LOG_STRING(DLT_LOG_ERROR, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() Unable to create filesrc");
}
demux = gst_element_factory_make("matroskademux", "demux");
if (!demux)
{
EAPP_LOG_STRING(DLT_LOG_ERROR, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() Unable to create matroskademux");
}
pipelineData.mVideoQueue = gst_element_factory_make("queue",
"videoqueue");
if (!pipelineData.mVideoQueue)
{
EAPP_LOG_STRING(DLT_LOG_ERROR, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() Unable to create videoqueue");
}
GstElement *vp8dec = gst_element_factory_make("vp8dec", "vp8dec");
if (!vp8dec)
{
EAPP_LOG_STRING(DLT_LOG_ERROR, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() Unable to create vp8dec");
}
appsink = gst_element_factory_make("appsink", "appsink");
if (!appsink)
{
EAPP_LOG_STRING(DLT_LOG_ERROR, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() Unable to create appsink");
}
g_object_set(filesrc, "location", mFileSrcName.c_str(), NULL);
gst_bin_add_many (GST_BIN(mPipeline), filesrc, demux,
pipelineData.mVideoQueue, vp8dec, appsink, NULL);
// link video-branch of pipeline
if (!gst_element_link_many (pipelineData.mVideoQueue, vp8dec, appsink,
NULL))
{
EAPP_LOG_STRING(DLT_LOG_ERROR, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() Cannot link video-branch");
gst_object_unref (GST_OBJECT (mPipeline));
mPipeline = NULL;
res = Ias::IasResult::cInitFailed;
}
// link start of pipeline, only filesrc and demux
if (!gst_element_link_many (filesrc, demux, NULL))
{
LOG_TIME("not able to create one of the element for video gst");
gst_object_unref (GST_OBJECT (mPipeline));
mPipeline = NULL;
res = Ias::IasResult::cInitFailed;
}
}
else if((mComponentType == eImage) || (mComponentType ==
eImageLowerScreen))
{
mPipeline = gst_pipeline_new ("early_image");
GstElement *filesrc = gst_element_factory_make("filesrc", "imagesrc");
if (!filesrc)
{
EAPP_LOG_STRING(DLT_LOG_ERROR, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() Unable to create filesrc");
}
GstElement *pngdec = gst_element_factory_make("pngdec", "pngdec");
if (!pngdec)
{
EAPP_LOG_STRING(DLT_LOG_ERROR, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() Unable to create pngdec");
}
GstElement *imagefreeze = gst_element_factory_make("imagefreeze",
"imagefreeze");
if (!imagefreeze)
{
EAPP_LOG_STRING(DLT_LOG_ERROR, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() Unable to create imagefreeze");
}
appsink = gst_element_factory_make("appsink", "appsink");
if (!appsink)
{
EAPP_LOG_STRING(DLT_LOG_ERROR, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() Unable to create appsink");
}
g_object_set(filesrc, "location", mFileSrcName.c_str(), NULL);
gst_bin_add_many (GST_BIN(mPipeline), filesrc, pngdec, imagefreeze,
appsink, NULL);
// link video-branch of pipeline
if (!gst_element_link_many (filesrc, pngdec, imagefreeze, appsink,
NULL))
{
LOG_TIME("NGIEarlyAppGStreamerWrapper::initGst() not able to create one
of the element for Image gst");
gst_object_unref (GST_OBJECT (mPipeline));
mPipeline = NULL;
res = Ias::IasResult::cInitFailed;
}
}
else
{
LOG_TIME("NGIEarlyAppGStreamerWrapper::initGst() not my component");
}
}
if (IAS_SUCCEEDED(res))
{
EAPP_LOG_STRING(DLT_LOG_VERBOSE, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() is success");
GstAppSinkCallbacks callbacks = { NULL, onPreroll, onNewImage,
onNewImageList, { NULL } };
gst_app_sink_set_callbacks (GST_APP_SINK(appsink), &callbacks,
gpointer(mListener), NULL);
if(mComponentType == eVideo)
{
/* Connect to the pad-added signal */
g_signal_connect (demux, "pad-added", G_CALLBACK (onNewPad),
&pipelineData);
}
mIsActive = true;
}
EAPP_LOG_STRING(DLT_LOG_VERBOSE, "[STC:EAPP]
NGIEarlyAppGStreamerWrapper::initGst() Out");
return res;
}
}
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/gstreamer-pipeline-creation-fails-in-case-of-concurrent-initialization-tp4677535p4677538.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list