Usage of queue2

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Usage of queue2

Hi Folks

I am not able fathom exact usage of queue2 from documentation or examples.
Could you someone please educate about exact usage of queue2, or spot a
problem with my code below  ?


1. This is how my pipeline looks -

/* Create the elements */
  data.source = gst_element_factory_make ("filesrc", "my_filesource");
  data.decode = gst_element_factory_make ("decodebin", "my_decoder");
  data.sink = gst_element_factory_make ("nveglglessink" , "vsink");
  data.filter   = gst_element_factory_make ("plugin", "my_filter");
  data.queue2   = gst_element_factory_make ("queue2", "queue");

  /* Create the empty pipeline */
  data.pipeline = gst_pipeline_new ("test-pipeline");

  if (!data.pipeline || !data.source || !data.decode || !data.sink ||
!data.filter ||  !data.queue2) {
    g_printerr ("Not all elements could be created.\n");
    return -1;

  /* Build the pipeline. Note that we are NOT linking the source at this
   * point. We will do it later. */
  gst_bin_add_many (GST_BIN (data.pipeline), data.source, data.queue2,
data.decode , data.sink, NULL);
  if (!gst_element_link_many (data.source, data.queue2, data.decode, NULL))
    g_printerr ("Elements could not be linked.\n");
    gst_object_unref (data.pipeline);
    return -1;

2. Then I set the pipeline to PAUSED state in order to let queue2 fill up.
ret = gst_element_set_state (data.pipeline, GST_STATE_PAUSED);
    g_printerr ("Unable to set the pipeline to the playing state.\n");
    gst_object_unref (data.pipeline);
    return -1;

3. I switch to PLAYING STATE when there is enough data in queue2 (100%)

      gint percent = 0;

      /* If the stream is live, we do not care about buffering. */
      //if (data.is_live) break;

      gst_message_parse_buffering (msg, &percent);
      g_print ("Buffering (%3d%%)\r", percent);
      /* Wait until buffering is complete before start/resume playing */
      if (percent < 100)
        gst_element_set_state (data.pipeline, GST_STATE_PAUSED);
        gst_element_set_state (data.pipeline, GST_STATE_PLAYING);

4. Upon run I see -

Pipeline state changed from NULL to READY:

(gst-app:13612): GStreamer-CRITICAL **: pushing on pad typefind:src but it
was not activated in push mode

(gst-app:13612): GStreamer-WARNING **:
Trying to join task 0x621170 from its thread would deadlock.
You cannot change the state of an element from its streaming
thread. Use g_idle_add() or post a GstMessage on the bus to
schedule the state change from the main thread.

Error received from element my_decoder: Your GStreamer installation is
missing a plug-in.
Debugging information: gstdecodebin2.c(4565): gst_decode_bin_expose ():
no suitable plugins found:
Couldn't set qtdemux0 to PAUSED

Segmentation fault (core dumped)

Sent from:
gstreamer-devel mailing list
[hidden email]