mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
aggregator: Only send events up to CAPS event from gst_aggregator_set_src_caps()
Otherwise setting the srcpad caps based on the sinkpad caps event will already push a segment event downstream before the upstream segment is known. If the upstream segments are just forwarded when the upstream segment event arrives this would result in two segment events being sent downstream, of which the first one will usually be simply wrong. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2372>
This commit is contained in:
parent
8ec4452d67
commit
90584e29d7
1 changed files with 8 additions and 7 deletions
|
@ -600,7 +600,7 @@ gst_aggregator_reset_flow_values (GstAggregator * self)
|
|||
}
|
||||
|
||||
static inline void
|
||||
gst_aggregator_push_mandatory_events (GstAggregator * self)
|
||||
gst_aggregator_push_mandatory_events (GstAggregator * self, gboolean up_to_caps)
|
||||
{
|
||||
GstAggregatorPrivate *priv = self->priv;
|
||||
GstEvent *segment = NULL;
|
||||
|
@ -620,7 +620,6 @@ gst_aggregator_push_mandatory_events (GstAggregator * self)
|
|||
}
|
||||
|
||||
if (self->priv->srccaps) {
|
||||
|
||||
GST_INFO_OBJECT (self, "pushing caps: %" GST_PTR_FORMAT,
|
||||
self->priv->srccaps);
|
||||
if (!gst_pad_push_event (GST_PAD (self->srcpad),
|
||||
|
@ -631,6 +630,9 @@ gst_aggregator_push_mandatory_events (GstAggregator * self)
|
|||
self->priv->srccaps = NULL;
|
||||
}
|
||||
|
||||
if (up_to_caps)
|
||||
return;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (self->priv->send_segment && !self->priv->flushing) {
|
||||
segment =
|
||||
|
@ -657,7 +659,6 @@ gst_aggregator_push_mandatory_events (GstAggregator * self)
|
|||
gst_pad_push_event (self->srcpad, segment);
|
||||
if (tags)
|
||||
gst_pad_push_event (self->srcpad, tags);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -672,14 +673,14 @@ gst_aggregator_set_src_caps (GstAggregator * self, GstCaps * caps)
|
|||
{
|
||||
GST_PAD_STREAM_LOCK (self->srcpad);
|
||||
gst_caps_replace (&self->priv->srccaps, caps);
|
||||
gst_aggregator_push_mandatory_events (self);
|
||||
gst_aggregator_push_mandatory_events (self, TRUE);
|
||||
GST_PAD_STREAM_UNLOCK (self->srcpad);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_aggregator_default_finish_buffer (GstAggregator * self, GstBuffer * buffer)
|
||||
{
|
||||
gst_aggregator_push_mandatory_events (self);
|
||||
gst_aggregator_push_mandatory_events (self, FALSE);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (!self->priv->flushing && gst_pad_is_active (self->srcpad)) {
|
||||
|
@ -718,7 +719,7 @@ static GstFlowReturn
|
|||
gst_aggregator_default_finish_buffer_list (GstAggregator * self,
|
||||
GstBufferList * bufferlist)
|
||||
{
|
||||
gst_aggregator_push_mandatory_events (self);
|
||||
gst_aggregator_push_mandatory_events (self, FALSE);
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (!self->priv->flushing && gst_pad_is_active (self->srcpad)) {
|
||||
|
@ -760,7 +761,7 @@ static void
|
|||
gst_aggregator_push_eos (GstAggregator * self)
|
||||
{
|
||||
GstEvent *event;
|
||||
gst_aggregator_push_mandatory_events (self);
|
||||
gst_aggregator_push_mandatory_events (self, FALSE);
|
||||
|
||||
event = gst_event_new_eos ();
|
||||
|
||||
|
|
Loading…
Reference in a new issue