diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2018-02-18 21:38:13 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2018-02-22 08:43:09 +0100 |
commit | c58838330d0931312a08a6f3f73ad3dcde9497d5 (patch) | |
tree | 7579c00c6e099b0c3d82acc5bcd205b747f37561 | |
parent | 3b5b102d10f1a50acde488d4bcb5e10e3f5564f5 (diff) | |
download | gstreamer-plugins-good-c58838330d0931312a08a6f3f73ad3dcde9497d5.tar.gz |
monoscope: Forward the SEGMENT event from the chain function
Otherwise we'll break the event order and forward the SEGMENT event
before sending a CAPS event.
-rw-r--r-- | gst/monoscope/gstmonoscope.c | 14 | ||||
-rw-r--r-- | gst/monoscope/gstmonoscope.h | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/gst/monoscope/gstmonoscope.c b/gst/monoscope/gstmonoscope.c index 0cbde7412..e06196b1e 100644 --- a/gst/monoscope/gstmonoscope.c +++ b/gst/monoscope/gstmonoscope.c @@ -163,6 +163,7 @@ gst_monoscope_reset (GstMonoscope * monoscope) 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; @@ -345,6 +346,12 @@ gst_monoscope_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf) 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); @@ -470,7 +477,12 @@ gst_monoscope_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) * 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: diff --git a/gst/monoscope/gstmonoscope.h b/gst/monoscope/gstmonoscope.h index b66a6d2f3..da2332713 100644 --- a/gst/monoscope/gstmonoscope.h +++ b/gst/monoscope/gstmonoscope.h @@ -54,6 +54,7 @@ struct _GstMonoscope GstBufferPool *pool; GstSegment segment; + gboolean segment_pending; /* QoS stuff *//* with LOCK */ gdouble proportion; |