mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
pad-monitor: Move repeated caps to test only on sinkpads
Testing on source pads can lead to false positives when pads are unlinked. The caps event is sticky and will be pushed again later when another buffer/event is pushed, leading to an acceptable situation to push the caps twice.
This commit is contained in:
parent
b591f11b15
commit
2ba098976a
1 changed files with 33 additions and 19 deletions
|
@ -1101,8 +1101,9 @@ gst_validate_pad_monitor_common_event_check (GstValidatePadMonitor *
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_validate_pad_monitor_sink_event_check (GstValidatePadMonitor * pad_monitor,
|
gst_validate_pad_monitor_downstream_event_check (GstValidatePadMonitor *
|
||||||
GstObject * parent, GstEvent * event, GstPadEventFunction handler)
|
pad_monitor, GstObject * parent, GstEvent * event,
|
||||||
|
GstPadEventFunction handler)
|
||||||
{
|
{
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
const GstSegment *segment;
|
const GstSegment *segment;
|
||||||
|
@ -1113,13 +1114,6 @@ gst_validate_pad_monitor_sink_event_check (GstValidatePadMonitor * pad_monitor,
|
||||||
|
|
||||||
/* pre checks */
|
/* pre checks */
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_CAPS:{
|
|
||||||
GstCaps *caps;
|
|
||||||
|
|
||||||
gst_event_parse_caps (event, &caps);
|
|
||||||
gst_validate_pad_monitor_setcaps_pre (pad_monitor, caps);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GST_EVENT_SEGMENT:
|
case GST_EVENT_SEGMENT:
|
||||||
/* parse segment data to be used if event is handled */
|
/* parse segment data to be used if event is handled */
|
||||||
gst_event_parse_segment (event, &segment);
|
gst_event_parse_segment (event, &segment);
|
||||||
|
@ -1189,13 +1183,6 @@ gst_validate_pad_monitor_sink_event_check (GstValidatePadMonitor * pad_monitor,
|
||||||
|
|
||||||
/* post checks */
|
/* post checks */
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_CAPS:{
|
|
||||||
GstCaps *caps;
|
|
||||||
|
|
||||||
gst_event_parse_caps (event, &caps);
|
|
||||||
gst_validate_pad_monitor_setcaps_post (pad_monitor, caps, ret);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GST_EVENT_SEGMENT:
|
case GST_EVENT_SEGMENT:
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (!pad_monitor->has_segment
|
if (!pad_monitor->has_segment
|
||||||
|
@ -1347,8 +1334,33 @@ gst_validate_pad_monitor_sink_event_func (GstPad * pad, GstObject * parent,
|
||||||
event, last_ts);
|
event, last_ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gst_validate_pad_monitor_sink_event_check (pad_monitor, parent, event,
|
/* pre checks */
|
||||||
pad_monitor->event_func);
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
|
case GST_EVENT_CAPS:{
|
||||||
|
GstCaps *caps;
|
||||||
|
|
||||||
|
gst_event_parse_caps (event, &caps);
|
||||||
|
gst_validate_pad_monitor_setcaps_pre (pad_monitor, caps);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ret =
|
||||||
|
gst_validate_pad_monitor_downstream_event_check (pad_monitor, parent,
|
||||||
|
event, pad_monitor->event_func);
|
||||||
|
/* post checks */
|
||||||
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
|
case GST_EVENT_CAPS:{
|
||||||
|
GstCaps *caps;
|
||||||
|
|
||||||
|
gst_event_parse_caps (event, &caps);
|
||||||
|
gst_validate_pad_monitor_setcaps_post (pad_monitor, caps, ret);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
|
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
|
||||||
GST_VALIDATE_PAD_MONITOR_PARENT_UNLOCK (pad_monitor);
|
GST_VALIDATE_PAD_MONITOR_PARENT_UNLOCK (pad_monitor);
|
||||||
|
@ -1502,7 +1514,9 @@ gst_validate_pad_monitor_event_probe (GstPad * pad, GstEvent * event,
|
||||||
|
|
||||||
/* This so far is just like an event that is flowing downstream,
|
/* This so far is just like an event that is flowing downstream,
|
||||||
* so we do the same checks as a sinkpad event handler */
|
* so we do the same checks as a sinkpad event handler */
|
||||||
ret = gst_validate_pad_monitor_sink_event_check (monitor, NULL, event, NULL);
|
ret =
|
||||||
|
gst_validate_pad_monitor_downstream_event_check (monitor, NULL, event,
|
||||||
|
NULL);
|
||||||
GST_VALIDATE_MONITOR_UNLOCK (monitor);
|
GST_VALIDATE_MONITOR_UNLOCK (monitor);
|
||||||
GST_VALIDATE_PAD_MONITOR_PARENT_UNLOCK (monitor);
|
GST_VALIDATE_PAD_MONITOR_PARENT_UNLOCK (monitor);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue