|
Hello to everyone!
I have problem when I stop my pipline. I have class video pipline:
TVideo::TVideo(int iNumberDevice)
{
gst_init (NULL,NULL);
geVideoSrc = gst_element_factory_make("v4l2src", "source");
g_assert(geVideoSrc);
QString strTmp = "/dev/video" + QString::number(NumDev);
const gchar* tmp = strTmp.toLatin1();
g_object_set (G_OBJECT (geVideoSrc), "device", tmp, NULL);
}
TVideo::~TVideo()
{
gst_object_unref (GST_OBJECT (gePipline));
}
int TVideo::Init()
{
gePipline = gst_pipeline_new("pipeline");
g_assert(gePipline);
geVideoRate = gst_element_factory_make("videorate", "vrate1");
g_assert(geVideoRate);
geVideoScale = gst_element_factory_make("videoscale", "vscale1");
g_assert(geVideoScale);
geVideoOut1 = gst_element_factory_make("fakesink", "video out1");
g_assert(geVideoOut1);
gst_bin_add_many(GST_BIN(gePipline), geVideoSrc, geVideoRate,geVideoScale,geVideoOut1, NULL);
........
gst_element_set_state(GST_ELEMENT(gePipline), GST_STATE_READY);
gst_element_set_state(GST_ELEMENT(gePipline), GST_STATE_PAUSED);
return 1;
}
int TVideo::StartCapture()
{
gst_element_set_state(GST_ELEMENT(gePipline), GST_STATE_PLAYING);
g_print ("Running video... \n");
return 1;
}
int TVideo::StopCapture()
{
gst_element_set_state(gePipline, GST_STATE_PAUSED);
gst_element_set_state(gePipline, GST_STATE_READY);
gst_element_set_state(gePipline, GST_STATE_NULL);
return 1;
}
So, when I start create 24 objects and call Init() and StartCapture(), all working. But when I stop process and call StopCapture() appear Segmentation fault error. It appeared when I am changing state (GST_STATE_PAUSED->GST_STATE_READY) of some object (Maybe 1, maybe 17, maybe 23) . If I remove it operation error appear again (GST_STATE_PAUSED->GST_STATE_NULL).
So what I do wrong?
|