gst_element_set_state deadlocks

gotsring gotsring at live.com
Mon Jan 11 18:21:15 UTC 2021


To flush the queue, you can do something like the following:
 - Get the queue sink and src pads
 - Add a probe to the src pad with a new callback to delete EOS signals
 - Send an EOS to the sink pad
 - In the callback function, wait for the EOS to arrive, then delete it. The
queue should be flushed.
 - Set the queue to NULL and do whatever.

If you have to flush the rtspsrc, you'll have to send the EOS to that
instead of the queue sink pad (I've never done this, though, so can't speak
on this).

Something like:
GstPad * sinkpad = gst_element_get_static_pad(queue, "sink");
GstPad * srcpad = gst_element_get_static_pad(queue, "src");
gst_pad_add_probe(srcpad, GST_PAD_PROBE_TYPE_EVENT, delete_eos_cb, userdata,
NULL);
gst_pad_send_event(sinkpad, gst_event_new_eos());
gst_object_unref(srcpad);
gst_object_unref(sinkpad);

// ...

static GstPadProbeReturn delete_eos_cb(GstPad* pad, GstPadProbeInfo* info,
gpointer userdata)
{
  GstEvent* pad_event = gst_pad_probe_get_event(info);
  if (pad_event->type == GST_EVENT_EOS)
  {
    // EOS went through the element
    // Do something with rtspsrc and queue

    return GST_PAD_PROBE_DROP; // Delete the EOS to prevent flushing the
entire pipeline
  }
  return GST_PAD_PROBE_OK; // Otherwise, pass the event onwards
}


On a side note, I recently had a problem where I was trying to set an
element to NULL before removing it from a pipeline, but this was in
deadlock. To solve this, instead of altering the pipeline in the bus message
handler, I scheduled a function to run a bit later using something similar
to your QTimer::singleShot. Just FYI.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list