How to have control over the Pipeline's Bus Callbacks when using RTSP Server?

Mariano Koremblum nicolas.koremblum at globant.com
Fri Jun 5 14:23:49 UTC 2020


I am trying to have control over my RTSP Server Pipeline buses callbacks, but
I cannot find the way. The thing is that RTSP Server automatically sets the
bus watcher for the pipelines and then I cannot recover it. Here I saw that
the server makes the gst_bus_create_watch():

https://github.com/alessandrod/gst-rtsp-server/blob/master/gst/rtsp-server/rtsp-media.c

It uses a function "bus_message" that then calls the
"default_handle_message" function (klass->handle_message) that manages the
events. So I tried to override it as follows:

/#define TEST_TYPE_RTSP_MEDIA (test_rtsp_media_get_type())

typedef struct TestRTSPMediaClass    TestRTSPMediaClass;
typedef struct TestRTSPMedia         TestRTSPMedia;

struct TestRTSPMediaClass
{
    GstRTSPMediaClass parent;
};

struct TestRTSPMedia
{
    GstRTSPMedia parent;
};

static gboolean custom_handle_message (GstRTSPMedia * media, GstMessage *
message);

G_DEFINE_TYPE(TestRTSPMedia, test_rtsp_media, GST_TYPE_RTSP_MEDIA);

static void
test_rtsp_media_class_init(TestRTSPMediaClass *test_klass)
{
    GstRTSPMediaClass *klass = (GstRTSPMediaClass *)(test_klass);
    klass->handle_message = custom_handle_message;
}

static void
test_rtsp_media_init(TestRTSPMedia *media)
{
} /

The thing now is that I am not really sure which and how to set an object as
"TEST_TYPE_RTSP_MEDIA" in order to get the bus handler function overriden
but keeping the things working as before.

Another thing I tried doing was to remove the watcher an then add the one I
wanted (on the factory signal "media-configure") but couldn't do it, mainly
because it uses a "source" to attach the signal and I am not really sure how
to get it, I always ran into messages like:

GStreamer-CRITICAL **: 18:45:25.964: gst_element_get_bus: assertion
'GST_IS_ELEMENT (element)' failed

GStreamer-CRITICAL **: 18:45:25.964: gst_bus_remove_watch: assertion
'GST_IS_BUS (bus)' failed

or

GStreamer-CRITICAL **: 18:53:19.372: gst_bus_create_watch: assertion
'bus->priv->poll != NULL' failed

GLib-CRITICAL **: 18:53:19.372: g_source_set_callback: assertion 'source !=
NULL' failed

or

(gst_rtsp_override.bin:9525): GLib-CRITICAL **: 18:52:12.500: Source ID 2
was not found when attempting to remove it

And never gets the watcher removed since I watched the debug logs and there
is always some entries on the "default_handle_message".

Sorry for the long post! I would really appreciate any help you can provide
me! Thanks a lot in advance! :)




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


More information about the gstreamer-devel mailing list