mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
rtspsrc: Don't blindly copy over sticky events from manager pad to external source pad
This would get around the code that modifies some events when they go through the ghost pad's proxypad. Instead go via the event function. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3409>
This commit is contained in:
parent
a4674a1e17
commit
e6a2e41c06
1 changed files with 38 additions and 12 deletions
|
@ -3108,15 +3108,10 @@ gst_rtspsrc_stream_start_event_add_group_id (GstRTSPSrc * src, GstEvent * event)
|
||||||
gst_event_set_group_id (event, src->group_id);
|
gst_event_set_group_id (event, src->group_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstEvent *
|
||||||
gst_rtspsrc_handle_src_sink_event (GstPad * pad, GstObject * parent,
|
gst_rtspsrc_update_src_event (GstRTSPSrc * self, GstRTSPStream * stream,
|
||||||
GstEvent * event)
|
GstEvent * event)
|
||||||
{
|
{
|
||||||
GstRTSPStream *stream;
|
|
||||||
GstRTSPSrc *self = GST_RTSPSRC (GST_OBJECT_PARENT (parent));
|
|
||||||
|
|
||||||
stream = gst_pad_get_element_private (pad);
|
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_STREAM_START:{
|
case GST_EVENT_STREAM_START:{
|
||||||
GChecksum *cs;
|
GChecksum *cs;
|
||||||
|
@ -3146,6 +3141,20 @@ gst_rtspsrc_handle_src_sink_event (GstPad * pad, GstObject * parent,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_rtspsrc_handle_src_sink_event (GstPad * pad, GstObject * parent,
|
||||||
|
GstEvent * event)
|
||||||
|
{
|
||||||
|
GstRTSPStream *stream;
|
||||||
|
GstRTSPSrc *self = GST_RTSPSRC (GST_OBJECT_PARENT (parent));
|
||||||
|
|
||||||
|
stream = gst_pad_get_element_private (pad);
|
||||||
|
|
||||||
|
event = gst_rtspsrc_update_src_event (self, stream, event);
|
||||||
|
|
||||||
return gst_pad_push_event (stream->srcpad, event);
|
return gst_pad_push_event (stream->srcpad, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3459,13 +3468,24 @@ udpsrc_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
|
||||||
return GST_PAD_PROBE_OK;
|
return GST_PAD_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GstRTSPSrc *src;
|
||||||
|
GstRTSPStream *stream;
|
||||||
|
} CopyStickyEventsData;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
copy_sticky_events (GstPad * pad, GstEvent ** event, gpointer user_data)
|
copy_sticky_events (GstPad * pad, GstEvent ** event, gpointer user_data)
|
||||||
{
|
{
|
||||||
GstPad *gpad = GST_PAD_CAST (user_data);
|
CopyStickyEventsData *data = user_data;
|
||||||
|
GstEvent *new_event;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (gpad, "store sticky event %" GST_PTR_FORMAT, *event);
|
GST_DEBUG_OBJECT (data->stream->srcpad, "send sticky event %" GST_PTR_FORMAT,
|
||||||
gst_pad_store_sticky_event (gpad, *event);
|
*event);
|
||||||
|
new_event =
|
||||||
|
gst_rtspsrc_update_src_event (data->src, data->stream,
|
||||||
|
gst_event_ref (*event));
|
||||||
|
gst_pad_store_sticky_event (data->stream->srcpad, new_event);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -3511,6 +3531,7 @@ new_manager_pad (GstElement * manager, GstPad * pad, GstRTSPSrc * src)
|
||||||
GstRTSPStream *stream;
|
GstRTSPStream *stream;
|
||||||
gboolean all_added;
|
gboolean all_added;
|
||||||
GstPad *internal_src;
|
GstPad *internal_src;
|
||||||
|
CopyStickyEventsData copy_sticky_events_data;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (src, "got new manager pad %" GST_PTR_FORMAT, pad);
|
GST_DEBUG_OBJECT (src, "got new manager pad %" GST_PTR_FORMAT, pad);
|
||||||
|
|
||||||
|
@ -3560,12 +3581,17 @@ new_manager_pad (GstElement * manager, GstPad * pad, GstRTSPSrc * src)
|
||||||
GST_PAD (gst_proxy_pad_get_internal (GST_PROXY_PAD (stream->srcpad)));
|
GST_PAD (gst_proxy_pad_get_internal (GST_PROXY_PAD (stream->srcpad)));
|
||||||
gst_pad_set_element_private (internal_src, stream);
|
gst_pad_set_element_private (internal_src, stream);
|
||||||
gst_pad_set_event_function (internal_src, gst_rtspsrc_handle_src_sink_event);
|
gst_pad_set_event_function (internal_src, gst_rtspsrc_handle_src_sink_event);
|
||||||
gst_object_unref (internal_src);
|
|
||||||
|
|
||||||
gst_pad_set_event_function (stream->srcpad, gst_rtspsrc_handle_src_event);
|
gst_pad_set_event_function (stream->srcpad, gst_rtspsrc_handle_src_event);
|
||||||
gst_pad_set_query_function (stream->srcpad, gst_rtspsrc_handle_src_query);
|
gst_pad_set_query_function (stream->srcpad, gst_rtspsrc_handle_src_query);
|
||||||
gst_pad_set_active (stream->srcpad, TRUE);
|
gst_pad_set_active (stream->srcpad, TRUE);
|
||||||
gst_pad_sticky_events_foreach (pad, copy_sticky_events, stream->srcpad);
|
|
||||||
|
copy_sticky_events_data.src = src;
|
||||||
|
copy_sticky_events_data.stream = stream;
|
||||||
|
gst_pad_sticky_events_foreach (pad, copy_sticky_events,
|
||||||
|
©_sticky_events_data);
|
||||||
|
|
||||||
|
gst_object_unref (internal_src);
|
||||||
|
|
||||||
/* don't add the srcpad if this is a sendonly stream */
|
/* don't add the srcpad if this is a sendonly stream */
|
||||||
if (stream->is_backchannel)
|
if (stream->is_backchannel)
|
||||||
|
|
Loading…
Reference in a new issue