consistencychecker: Check for STREAM_START event

Check that it is always before any serialized event.
This commit is contained in:
Edward Hervey 2012-07-06 11:38:58 +02:00
parent dcc35b9c67
commit 617eba488a

View file

@ -40,6 +40,8 @@ struct _GstStreamConsistency
volatile gboolean segment; volatile gboolean segment;
volatile gboolean eos; volatile gboolean eos;
volatile gboolean expect_flush; volatile gboolean expect_flush;
volatile gboolean saw_serialized_event;
volatile gboolean saw_stream_start;
GstObject *parent; GstObject *parent;
GList *pads; GList *pads;
}; };
@ -71,7 +73,7 @@ source_pad_data_cb (GstPad * pad, GstPadProbeInfo * info,
} else if (GST_IS_EVENT (data)) { } else if (GST_IS_EVENT (data)) {
GstEvent *event = (GstEvent *) data; GstEvent *event = (GstEvent *) data;
GST_DEBUG_OBJECT (pad, "%s", GST_EVENT_TYPE_NAME (event)); GST_DEBUG_OBJECT (pad, "Event : %s", GST_EVENT_TYPE_NAME (event));
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_START: case GST_EVENT_FLUSH_START:
/* getting two flush_start in a row seems to be okay /* getting two flush_start in a row seems to be okay
@ -87,6 +89,10 @@ source_pad_data_cb (GstPad * pad, GstPadProbeInfo * info,
consist->flushing = consist->expect_flush = FALSE; consist->flushing = consist->expect_flush = FALSE;
break; break;
case GST_EVENT_STREAM_START: case GST_EVENT_STREAM_START:
fail_if (consist->saw_serialized_event && !consist->saw_stream_start,
"Got a STREAM_START event after a serialized event");
consist->saw_stream_start = TRUE;
break;
case GST_EVENT_STREAM_CONFIG: case GST_EVENT_STREAM_CONFIG:
case GST_EVENT_CAPS: case GST_EVENT_CAPS:
/* ok to have these before segment event */ /* ok to have these before segment event */
@ -116,6 +122,12 @@ source_pad_data_cb (GstPad * pad, GstPadProbeInfo * info,
/* FIXME : Figure out what to do for other events */ /* FIXME : Figure out what to do for other events */
break; break;
} }
if (GST_EVENT_IS_SERIALIZED (event)) {
fail_if (!consist->saw_stream_start
&& GST_EVENT_TYPE (event) != GST_EVENT_STREAM_START,
"Got a serialized event before a STREAM_START");
consist->saw_serialized_event = TRUE;
}
} }
return TRUE; return TRUE;
@ -252,9 +264,12 @@ gst_consistency_checker_add_pad (GstStreamConsistency * consist, GstPad * pad)
void void
gst_consistency_checker_reset (GstStreamConsistency * consist) gst_consistency_checker_reset (GstStreamConsistency * consist)
{ {
consist->eos = FALSE;
consist->flushing = FALSE; consist->flushing = FALSE;
consist->segment = FALSE; consist->segment = FALSE;
consist->eos = FALSE;
consist->expect_flush = FALSE;
consist->saw_serialized_event = FALSE;
consist->saw_stream_start = FALSE;
} }
/** /**