Reinitialise gstreamer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Reinitialise gstreamer

wilson1994
Hi,

If I reinitialise gstreamer (gst_init (&argc, &argv) ) after previously
initialising and deinitialising it, then the creation of a new pipeline
fails. You can reproduce it with this very simple example:

    #include <gst/gst.h>

    int main(int argc, char *argv[]) {
      GstElement *pipeline;

      gst_init (&argc, &argv);

      pipeline = gst_pipeline_new ("test-pipeline");
      g_assert(pipeline);

      gst_object_unref (pipeline);

      gst_deinit();

      gst_init (&argc, &argv);

      pipeline = gst_pipeline_new ("test-pipeline");
      g_assert(pipeline);

      gst_object_unref (pipeline);

      return 0;
    }

at the second g_assert(pipeline) I get the following error:

ERROR:main.c:20:main: assertion failed: (pipeline)
Bail out! ERROR:main.c:20:main: assertion failed: (pipeline)

Is this a bug, or is it not allowed to deinit gstreamer if you want to
initialize it again later?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Reinitialise gstreamer

Tim Müller
On Tue, 2019-11-12 at 06:10 -0600, wilson1994 wrote:

Hi,

> If I reinitialise gstreamer (gst_init (&argc, &argv) ) after
> previously initialising and deinitialising it, then the creation of a
> new pipeline fails. (snip code)
>
> Is this a bug, or is it not allowed to deinit gstreamer if you want
> to initialize it again later?

From the API documentation for gst_deinit():

   Clean up any resources created by GStreamer in gst_init().
It is
normally not needed to call this function in a normal application as
the resources will automatically be freed when the program terminates.
This function is therefore mostly used by testsuites and other memory
profiling tools.
After this call GStreamer (including this method)
should not be used anymore.


In other words, calling gst_init() again after gst_deinit() is not supported.

Cheers
 Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel