From 980925a6a39249d1a8784911afef5cc795e44785 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 26 Jan 2022 11:22:31 +0530 Subject: [PATCH] rtspsrc: Fix critical while serializing timeout element message The "cause" field wasn't registered as a GEnumValue, so do that. Fixes this critical in gst_structure_to_string(): `gst_value_serialize: assertion 'G_IS_VALUE (value)' failed` Part-of: --- subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c index 063b761..0032ae5 100644 --- a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c +++ b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c @@ -161,6 +161,23 @@ enum _GstRtspSrcRtcpSyncMode RTCP_SYNC_RTP }; +#define GST_TYPE_RTSP_SRC_TIMEOUT_CAUSE (gst_rtsp_src_timeout_cause_get_type()) +static GType +gst_rtsp_src_timeout_cause_get_type (void) +{ + static GType timeout_cause_type = 0; + static const GEnumValue timeout_causes[] = { + {GST_RTSP_SRC_TIMEOUT_CAUSE_RTCP, "timeout triggered by RTCP", "RTCP"}, + {0, NULL, NULL}, + }; + + if (!timeout_cause_type) { + timeout_cause_type = + g_enum_register_static ("GstRTSPSrcTimeoutCause", timeout_causes); + } + return timeout_cause_type; +} + enum _GstRtspSrcBufferMode { BUFFER_MODE_NONE, @@ -1267,6 +1284,7 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass) gst_rtsp_ext_list_init (); + gst_type_mark_as_plugin_api (GST_TYPE_RTSP_SRC_TIMEOUT_CAUSE, 0); gst_type_mark_as_plugin_api (GST_TYPE_RTSP_SRC_BUFFER_MODE, 0); gst_type_mark_as_plugin_api (GST_TYPE_RTSP_SRC_NTP_TIME_SOURCE, 0); gst_type_mark_as_plugin_api (GST_TYPE_RTSP_BACKCHANNEL, 0); @@ -3632,8 +3650,8 @@ on_timeout (GObject * session, GObject * source, GstRTSPStream * stream) /* timeout, post element message */ gst_element_post_message (GST_ELEMENT_CAST (src), gst_message_new_element (GST_OBJECT_CAST (src), - gst_structure_new ("GstRTSPSrcTimeout", - "cause", G_TYPE_ENUM, GST_RTSP_SRC_TIMEOUT_CAUSE_RTCP, + gst_structure_new ("GstRTSPSrcTimeout", "cause", + GST_TYPE_RTSP_SRC_TIMEOUT_CAUSE, GST_RTSP_SRC_TIMEOUT_CAUSE_RTCP, "stream-number", G_TYPE_INT, stream->id, "ssrc", G_TYPE_UINT, stream->ssrc, NULL))); -- 2.7.4