Search code examples
gstreamergstreamer-1.0python-gstreamer

New element is getting created even after unref of pipeline in gstreamer


I am trying to access appsink element to capture intermediate frames, and I have written a stream pipeline but when I change and start a new pipeline, I use gst_object_unref(pipeline, NULL) and set its state to NULL. But still when I check my pipeline instead of getting an element appsink0, I get appsink1 and after every start of new pipeline its keeps on incrementing for example. First pipeline i started : it has elements as v4l2src0, appsink0 Second pipeline i started after unref of first pipeline : it has elements as v4l2src1, appsink1 third pipeline i started after unref of second pipeline : it has elements as v4l2src2, appsink2. How to resolve this issue? Is it a pipeline issue or issue in gstreamer code? I am using static pipeline.

The following things I have tried : Using unref api from gstreamer : gst_object_unref(pipeline) Setting state to NULL : pipeline = NULL && gst_element_set_state(pipeline, GST_OBJECT_NULL)

I am expecting elements to start with 0 for example appsink0, v4l2src0 after unref the pipeline.


Solution

  • Elements usually get named with a ever increasing count whenever they are being created. This carries over across different pipelines. Use the name property of elements to give them a more "predictable" name.