mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
capsfilter: do not forget to push pending events
Push pending events before buffers if caps is already set
This commit is contained in:
parent
a93615aea1
commit
00da86036b
1 changed files with 24 additions and 10 deletions
|
@ -275,6 +275,20 @@ gst_capsfilter_transform_ip (GstBaseTransform * base, GstBuffer * buf)
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_capsfilter_push_pending_events (GstCapsFilter * filter, GList * events)
|
||||||
|
{
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
for (l = g_list_last (events); l; l = l->prev) {
|
||||||
|
GST_LOG_OBJECT (filter, "Forwarding %s event",
|
||||||
|
GST_EVENT_TYPE_NAME (l->data));
|
||||||
|
GST_BASE_TRANSFORM_CLASS (parent_class)->sink_event (GST_BASE_TRANSFORM_CAST
|
||||||
|
(filter), l->data);
|
||||||
|
}
|
||||||
|
g_list_free (events);
|
||||||
|
}
|
||||||
|
|
||||||
/* Ouput buffer preparation ... if the buffer has no caps, and our allowed
|
/* Ouput buffer preparation ... if the buffer has no caps, and our allowed
|
||||||
* output caps is fixed, then send the caps downstream, making sure caps are
|
* output caps is fixed, then send the caps downstream, making sure caps are
|
||||||
* sent before segment event.
|
* sent before segment event.
|
||||||
|
@ -289,14 +303,15 @@ gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input,
|
||||||
GstBuffer ** buf)
|
GstBuffer ** buf)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
GstCapsFilter *filter = GST_CAPSFILTER (trans);
|
||||||
|
|
||||||
/* always return the input as output buffer */
|
/* always return the input as output buffer */
|
||||||
*buf = input;
|
*buf = input;
|
||||||
|
|
||||||
if (GST_PAD_MODE (trans->srcpad) == GST_PAD_MODE_PUSH
|
if (GST_PAD_MODE (trans->srcpad) == GST_PAD_MODE_PUSH
|
||||||
&& !gst_pad_has_current_caps (trans->sinkpad)) {
|
&& !gst_pad_has_current_caps (trans->sinkpad)) {
|
||||||
|
|
||||||
/* No caps. See if the output pad only supports fixed caps */
|
/* No caps. See if the output pad only supports fixed caps */
|
||||||
GstCapsFilter *filter = GST_CAPSFILTER (trans);
|
|
||||||
GstCaps *out_caps;
|
GstCaps *out_caps;
|
||||||
GList *pending_events = filter->pending_events;
|
GList *pending_events = filter->pending_events;
|
||||||
|
|
||||||
|
@ -319,15 +334,7 @@ gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input,
|
||||||
if (!gst_pad_has_current_caps (trans->srcpad)) {
|
if (!gst_pad_has_current_caps (trans->srcpad)) {
|
||||||
if (gst_pad_set_caps (trans->srcpad, out_caps)) {
|
if (gst_pad_set_caps (trans->srcpad, out_caps)) {
|
||||||
if (pending_events) {
|
if (pending_events) {
|
||||||
GList *l;
|
gst_capsfilter_push_pending_events (filter, pending_events);
|
||||||
|
|
||||||
for (l = g_list_last (pending_events); l; l = l->prev) {
|
|
||||||
GST_LOG_OBJECT (trans, "Forwarding %s event",
|
|
||||||
GST_EVENT_TYPE_NAME (l->data));
|
|
||||||
GST_BASE_TRANSFORM_CLASS (parent_class)->sink_event (trans,
|
|
||||||
l->data);
|
|
||||||
}
|
|
||||||
g_list_free (pending_events);
|
|
||||||
pending_events = NULL;
|
pending_events = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -353,6 +360,13 @@ gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input,
|
||||||
|
|
||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
} else if (G_UNLIKELY (filter->pending_events)) {
|
||||||
|
GList *events = filter->pending_events;
|
||||||
|
|
||||||
|
filter->pending_events = NULL;
|
||||||
|
|
||||||
|
/* push pending events before a buffer */
|
||||||
|
gst_capsfilter_push_pending_events (filter, events);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue