gst_adapter_clear (monoscope->adapter);
gst_segment_init (&monoscope->segment, GST_FORMAT_UNDEFINED);
+ monoscope->segment_pending = FALSE;
GST_OBJECT_LOCK (monoscope);
monoscope->proportion = 1.0;
goto out;
}
+ if (monoscope->segment_pending) {
+ gst_pad_push_event (monoscope->srcpad,
+ gst_event_new_segment (&monoscope->segment));
+ monoscope->segment_pending = FALSE;
+ }
+
/* don't try to combine samples from discont buffer */
if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_DISCONT)) {
gst_adapter_clear (monoscope->adapter);
* we can do QoS */
gst_event_copy_segment (event, &monoscope->segment);
- res = gst_pad_push_event (monoscope->srcpad, event);
+ /* We forward the event from the chain function after caps are
+ * negotiated. Otherwise we would potentially break the event order and
+ * send the segment event before the caps event */
+ monoscope->segment_pending = TRUE;
+ gst_event_unref (event);
+ res = TRUE;
break;
}
case GST_EVENT_CAPS: