pad_monitor: Add a check for buffer DISCONT flag

The first buffer after a FLUSH or SEGMENT should have the DISCONT flag
set.
This commit is contained in:
Edward Hervey 2016-05-19 11:59:19 +02:00 committed by Edward Hervey
parent f4cdbd006b
commit ca38c4dc9a
4 changed files with 28 additions and 0 deletions

View file

@ -890,6 +890,7 @@ gst_validate_pad_monitor_init (GstValidatePadMonitor * pad_monitor)
pad_monitor->expired_events = NULL;
gst_segment_init (&pad_monitor->segment, GST_FORMAT_BYTES);
pad_monitor->first_buffer = TRUE;
pad_monitor->pending_buffer_discont = TRUE;
pad_monitor->timestamp_range_start = GST_CLOCK_TIME_NONE;
pad_monitor->timestamp_range_end = GST_CLOCK_TIME_NONE;
@ -1116,6 +1117,18 @@ static void
}
}
static void
gst_validate_pad_monitor_check_discont (GstValidatePadMonitor * pad_monitor,
GstBuffer * buffer)
{
if (pad_monitor->pending_buffer_discont) {
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT))
GST_VALIDATE_REPORT (pad_monitor, BUFFER_MISSING_DISCONT,
"Buffer is missing a DISCONT flag");
pad_monitor->pending_buffer_discont = FALSE;
}
}
static void
gst_validate_pad_monitor_check_first_buffer (GstValidatePadMonitor *
pad_monitor, GstBuffer * buffer)
@ -1569,6 +1582,9 @@ gst_validate_pad_monitor_common_event_check (GstValidatePadMonitor *
}
pad_monitor->pending_flush_stop = FALSE;
/* Buffers following a FLUSH should have the DISCONT flag set */
pad_monitor->pending_buffer_discont = TRUE;
/* cleanup our data */
gst_validate_pad_monitor_flush (pad_monitor);
}
@ -1728,6 +1744,8 @@ gst_validate_pad_monitor_downstream_event_check (GstValidatePadMonitor *
}
pad_monitor->pending_eos_seqnum = seqnum;
/* Buffers following a SEGMENT should have the DISCONT flag set */
pad_monitor->pending_buffer_discont = TRUE;
if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) {
gst_validate_pad_monitor_add_expected_newsegment (pad_monitor, event);
@ -2058,6 +2076,7 @@ gst_validate_pad_monitor_chain_func (GstPad * pad, GstObject * parent,
GST_VALIDATE_PAD_MONITOR_PARENT_LOCK (pad_monitor);
GST_VALIDATE_MONITOR_LOCK (pad_monitor);
gst_validate_pad_monitor_check_discont (pad_monitor, buffer);
gst_validate_pad_monitor_check_right_buffer (pad_monitor, buffer);
gst_validate_pad_monitor_check_first_buffer (pad_monitor, buffer);
gst_validate_pad_monitor_update_buffer_data (pad_monitor, buffer);
@ -2246,6 +2265,7 @@ gst_validate_pad_monitor_buffer_probe (GstPad * pad, GstBuffer * buffer,
GST_VALIDATE_PAD_MONITOR_PARENT_LOCK (monitor);
GST_VALIDATE_MONITOR_LOCK (monitor);
gst_validate_pad_monitor_check_discont (monitor, buffer);
gst_validate_pad_monitor_check_first_buffer (monitor, buffer);
gst_validate_pad_monitor_update_buffer_data (monitor, buffer);
gst_validate_pad_monitor_check_eos (monitor, buffer);

View file

@ -89,6 +89,10 @@ struct _GstValidatePadMonitor {
guint32 pending_newsegment_seqnum;
guint32 pending_eos_seqnum;
/* Whether the next buffer should have a DISCONT flag on it, because
* it's the first one, or follows a SEGMENT and/or a FLUSH */
gboolean pending_buffer_discont;
GstClockTime pending_seek_accurate_time;
GstEvent *expected_segment;

View file

@ -199,6 +199,9 @@ gst_validate_report_load_issues (void)
_("GST_FLOW_ERROR returned without posting an ERROR on the bus"),
_("Element MUST post a GST_MESSAGE_ERROR with GST_ELEMENT_ERROR before"
" returning GST_FLOW_ERROR"));
REGISTER_VALIDATE_ISSUE (WARNING, BUFFER_MISSING_DISCONT,
_("Buffer didn't have expected DISCONT flag"),
_("Buffers after SEGMENT and FLUSH must have a DISCONT flag"));
REGISTER_VALIDATE_ISSUE (ISSUE, CAPS_IS_MISSING_FIELD,
_("caps is missing a required field for its type"),

View file

@ -64,6 +64,7 @@ typedef enum {
#define BUFFER_AFTER_EOS _QUARK("buffer::after-eos")
#define WRONG_BUFFER _QUARK("buffer::not-expected-one")
#define FLOW_ERROR_WITHOUT_ERROR_MESSAGE _QUARK("buffer::flow-error-without-error-message")
#define BUFFER_MISSING_DISCONT _QUARK("buffer::missing-discont")
#define CAPS_IS_MISSING_FIELD _QUARK("caps::is-missing-field")
#define CAPS_FIELD_HAS_BAD_TYPE _QUARK("caps::field-has-bad-type")