Skip to content

gst: Add gst_call_async() and gst_object_call_async() variants

Seungha Yang requested to merge seungha.yang/gstreamer:object-async-call into main
Adding two gst_element_call_async() variant APIs, gst_object_call_async()
and gst_call_async(). gst_object_call_async() is functionally identical to
the gst_element_call_async() but it's allowed to be called against GstObject.
And gst_call_async() can be used for any asynchronous function call
without GstObject dependency.

Not only the case of state change which was mentioned in
the commit which introduced gst_element_call_async() API,
there are various cases where an operation must happen from another thread.
For instance, assume that an object has its own work thread
and the object can notify error via g_object_notify() or it's
variant from internal work thread. As a response of the notify callback,
callee might want to destroy the object. Then, which might
result in an attempt for destroying the object from its work thread
(i.e., try to join thread from self). To avoid the case, notification
must happen from non-work thread, or caller should destroy the
object from other thread.

Although each element/plugin can implement its own thread pool
for the case, expanding the gst_element_call_async() method
would be an easy way to provide a method for such cases.
Edited by Seungha Yang

Merge request reports