Pipeline with RTSPSRC stuch at gst_element_set_state(Pipeline, GST_STATE_NULL);

xaruch xuch at list.ru
Mon Apr 21 11:51:38 PDT 2014


Hello all!
I need your help..

I've got gstreamer 0.10.36 on embedded SBC.

But occasionally pipeline stuck at gst_element_set_state(Pipeline,
GST_STATE_NULL). I think thanks for rtspsrc because sometimes it occurs
after linking source pad to queue and no BusCall message for changing
filesink state.

It here two questions:
1) Why occasionally after successully linked source pad no occurs state
changing on filesink? File size is stay zero bytes.
2) Why trying to change pipeline' state to GST_STATE_NULL sometimes conducts
to hangup?

Below my code.

int CameraType::StartRec(string Path)
{
  //StartingRec
  CmState.Pipeline = gst_pipeline_new((const gchar *) string("rtsp_capture-"
+ Name).c_str());
  CmState.Source = gst_element_factory_make("rtspsrc", (const gchar *)
string("rtsp-source-" + Name).c_str());
  CmState.VideoQueue1 = gst_element_factory_make("queue", (const gchar *)
string("queue-" + Name).c_str());
g_object_set(CmState.Source, "protocols", GST_RTSP_LOWER_TRANS_TCP, NULL);
CmState.Depayer1 = gst_element_factory_make("rtpmp4vdepay", (const gchar *)
string("rtpmp4vdepay-" + Name).c_str());
g_object_set(CmState.Source, "location", UrlVidFormat[MPEG4].url.c_str()/*,
"retry", RTPSRC_RETRY, "tcp-timeout", RTPSRC_TCPTIMEOUT*/, NULL);
CmState.Muxer1 = gst_element_factory_make("mpegtsmux", (const gchar *)
string("mpeg-ts-muxer-1-" + Name).c_str());
CmState.Sink1 = gst_element_factory_make("filesink", (const gchar *)
string("file-output-1-" + Name).c_str());
  g_object_set(CmState.Sink1, "location", RecInfo.GetNewFullPath().c_str(),
NULL);
  CmState.Bus = gst_pipeline_get_bus(GST_PIPELINE (CmState.Pipeline));
  BusWatchId = gst_bus_add_watch(CmState.Bus, BusCall, this);
  gst_object_unref(CmState.Bus);
  gst_bin_add_many(GST_BIN (CmState.Pipeline), CmState.Source,
CmState.VideoQueue1, /*CmState.RtpJitterBuffer,*/ CmState.Depayer1,
CmState.Muxer1, CmState.Sink1, NULL);
  g_signal_connect(CmState.Source, "pad-added", G_CALLBACK(OnPadAdded),
this);
  gst_element_link(CmState.VideoQueue1, CmState.Depayer1);
  gst_element_link(CmState.Depayer1, CmState.Muxer1);
  gst_element_link(CmState.Muxer1, CmState.Sink1);
gret = gst_element_set_state(CmState.Pipeline, GST_STATE_PLAYING);
return 0;
}

int CameraType::StopRec()
{
gst_element_set_state(CmState.Pipeline, GST_STATE_NULL); // Occasionally
stuck here!!
  if (CmState.Pipeline != NULL)
    gst_object_unref(GST_OBJECT (CmState.Pipeline));
g_source_remove(BusWatchId);
return 0;
}

void CameraType::OnPadAdded(GstElement *element, GstPad *pad, gpointer data)
{
  const char *class_name = "CameraType::OnPadAdded";
  GstPad *sinkpad;
  CameraType *Cam = (CameraType *) data;
      sinkpad = gst_element_get_static_pad(Cam->CmState.VideoQueue1,
"sink");
      if (gst_pad_link(pad, sinkpad) != GST_PAD_LINK_OK)
        {
          sprintf(str, "Cam Type '%s' IP '%s' Desc '%s' Channel 1 pad
linking error!!! EXIT!\n", Cam->Name.c_str(), Cam->IP.c_str(),
Cam->Description.c_str());
          AppendLog(str, class_name, DEBUG);
          gst_object_unref(sinkpad);
          return;
        }
      gst_object_unref(sinkpad);
}





--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Pipeline-with-RTSPSRC-stuch-at-gst-element-set-state-Pipeline-GST-STATE-NULL-tp4666515.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list