mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
mimic: Ensure segment is sent before caps and buffer
https://bugzilla.gnome.org/show_bug.cgi?id=700420
This commit is contained in:
parent
2b25ef8564
commit
4c4fc14afc
3 changed files with 13 additions and 5 deletions
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -57,6 +57,7 @@ struct _GstMimEnc
|
|||
|
||||
gboolean paused_mode;
|
||||
GstSegment segment;
|
||||
GstEvent *pending_segment;
|
||||
GstClockTime last_buffer;
|
||||
GstClockID clock_id;
|
||||
gboolean stop_paused_mode;
|
||||
|
|
Loading…
Reference in a new issue