Handling GStreamer used by another application

Nicolas Dufresne nicolas at ndufresne.ca
Thu Jul 6 15:16:02 UTC 2017


Le jeudi 06 juillet 2017 à 05:18 -0700, jmz a écrit :
> Hi
> 
> I am developing a streamer application (as a library) based on GStreamer to
> provide some multimedia services such as playback and recording. A user
> application (app) can use the library to start, pause, and stop the
> services.
> 
> To start services, user app asks the library to create a streamer object.
> The object's construction process creates a context and main loop. Then a
> thread is created and it runs the main loop. Finally, a pointer to the
> object is returned to the app.
> 
> To stop services, user app calls g_object_unref() to destroy the streamer
> object. The object's destruction process calls g_main_loop_quit(), the
> thread frees the pipeline, and then the main loop (as well as the thread) is
> stopped. The context is also freed.
> 
> When an error occurs in the pipeline (for example, output window was
> closed), on_error callback in the streamer application is invoked to handle
> it without notifying the user app of the error (this may not be
> recommended). Shall I do any of the following in the on_error callback?
> 
> (a) do nothing
> (b) change the pipeline state to NULL (or others?)
> (c) invoke g_main_loop_quit()
> 
> If (a) or (b), a gst_element_get_state() called after
> gst_element_set_state(pipeline, GST_STATE_PAUSED) will block. Why?
> If (c), further changes made on the pipeline (requested by user app) may
> fail because the streamer object has been destroyed.
> 
> Is it proper to use (c)?

All choices are valid. It depends on how you want you application to
recover from an error ? With (c), recovery will likely be slow, as you
will have to re-create a thread, context, mainloop etc.

> 
> Thanks for any suggestions or help.
> 
> 
> 
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble
> .com/Handling-GStreamer-used-by-another-application-tp4683710.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170706/b5dd67a1/attachment.sig>


More information about the gstreamer-devel mailing list