summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2013-05-15 19:23:08 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2013-05-15 19:30:40 -0400
commit4c4fc14afc0b49108fa16fa752df2f961c059700 (patch)
tree8677da742e75a183ad918490a2e5a120fbead4ee
parent2b25ef8564cd2e5f5847d7a9850ecda2c539cfb7 (diff)
downloadgstreamer-plugins-bad-4c4fc14afc0b49108fa16fa752df2f961c059700.tar.gz
mimic: Ensure segment is sent before caps and buffer
https://bugzilla.gnome.org/show_bug.cgi?id=700420
-rw-r--r--ext/mimic/gstmimdec.c1
-rw-r--r--ext/mimic/gstmimenc.c16
-rw-r--r--ext/mimic/gstmimenc.h1
3 files changed, 13 insertions, 5 deletions
diff --git a/ext/mimic/gstmimdec.c b/ext/mimic/gstmimdec.c
index 041e12f24..07ed04d7f 100644
--- a/ext/mimic/gstmimdec.c
+++ b/ext/mimic/gstmimdec.c
@@ -353,7 +353,6 @@ gst_mim_dec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
case GST_EVENT_STREAM_START:
case GST_EVENT_FLUSH_STOP:
case GST_EVENT_EOS:
- mimdec->need_segment = FALSE;
gst_adapter_clear (mimdec->adapter);
break;
default:
diff --git a/ext/mimic/gstmimenc.c b/ext/mimic/gstmimenc.c
index 59f291396..c94c41188 100644
--- a/ext/mimic/gstmimenc.c
+++ b/ext/mimic/gstmimenc.c
@@ -209,6 +209,7 @@ gst_mim_enc_reset_locked (GstMimEnc * mimenc)
mimenc->width = 0;
mimenc->height = 0;
}
+ gst_event_replace (&mimenc->pending_segment, NULL);
}
static void
@@ -296,7 +297,6 @@ gst_mim_enc_chain (GstPad * pad, GstObject * parent, GstBuffer * in)
GST_OBJECT_LOCK (mimenc);
-
gst_buffer_map (in, &in_map, GST_MAP_READ);
out = gst_buffer_new_and_alloc (mimenc->buffer_size + TCP_HEADER_SIZE);
@@ -335,6 +335,11 @@ gst_mim_enc_chain (GstPad * pad, GstObject * parent, GstBuffer * in)
gst_buffer_unmap (out, &out_map);
gst_buffer_resize (out, 0, buffer_size + TCP_HEADER_SIZE);
+ if (G_UNLIKELY (mimenc->pending_segment)) {
+ gst_pad_push_event (mimenc->srcpad, mimenc->pending_segment);
+ mimenc->pending_segment = FALSE;
+ }
+
GST_OBJECT_UNLOCK (mimenc);
res = gst_pad_push (mimenc->srcpad, out);
@@ -375,6 +380,10 @@ gst_mim_enc_event (GstPad * pad, GstObject * parent, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_FLUSH_STOP:
+ gst_segment_init (&mimenc->segment, GST_FORMAT_UNDEFINED);
+ gst_event_replace (&mimenc->pending_segment, NULL);
+ break;
case GST_EVENT_EOS:
gst_mim_enc_reset (mimenc);
break;
@@ -396,6 +405,7 @@ gst_mim_enc_event (GstPad * pad, GstObject * parent, GstEvent * event)
if (mimenc->segment.format != GST_FORMAT_TIME)
goto newseg_wrong_format;
+ gst_event_replace (&mimenc->pending_segment, event);
forward = FALSE;
break;
@@ -513,12 +523,10 @@ gst_mim_enc_change_state (GstElement * element, GstStateChange transition)
gboolean paused_mode;
switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
-
-
case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_OBJECT_LOCK (mimenc);
gst_segment_init (&mimenc->segment, GST_FORMAT_UNDEFINED);
+ gst_event_replace (&mimenc->pending_segment, NULL);
mimenc->last_buffer = GST_CLOCK_TIME_NONE;
GST_OBJECT_UNLOCK (mimenc);
break;
diff --git a/ext/mimic/gstmimenc.h b/ext/mimic/gstmimenc.h
index 63e8503db..75113f659 100644
--- a/ext/mimic/gstmimenc.h
+++ b/ext/mimic/gstmimenc.h
@@ -57,6 +57,7 @@ struct _GstMimEnc
gboolean paused_mode;
GstSegment segment;
+ GstEvent *pending_segment;
GstClockTime last_buffer;
GstClockID clock_id;
gboolean stop_paused_mode;