pad-monitor: check that no buffers are pushed after a pad is EOS

Make sure no resources are wasted after elements are done with the
current segment
This commit is contained in:
Thiago Santos 2013-10-01 21:11:35 -03:00 committed by Thiago Santos
parent 28bd6ee17a
commit 385d6d4ccd
3 changed files with 19 additions and 0 deletions

View file

@ -835,6 +835,16 @@ gst_validate_pad_monitor_check_first_buffer (GstValidatePadMonitor *
}
}
static void
gst_validate_pad_monitor_check_eos (GstValidatePadMonitor *
pad_monitor, GstBuffer * buffer)
{
if (G_UNLIKELY (pad_monitor->is_eos)) {
GST_VALIDATE_REPORT (pad_monitor, BUFFER_AFTER_EOS,
"Received buffer %" GST_PTR_FORMAT " after EOS", buffer);
}
}
static void
gst_validate_pad_monitor_update_buffer_data (GstValidatePadMonitor *
pad_monitor, GstBuffer * buffer)
@ -1463,6 +1473,7 @@ gst_validate_pad_monitor_chain_func (GstPad * pad, GstObject * parent,
gst_validate_pad_monitor_check_first_buffer (pad_monitor, buffer);
gst_validate_pad_monitor_update_buffer_data (pad_monitor, buffer);
gst_validate_pad_monitor_check_eos (pad_monitor, buffer);
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
GST_VALIDATE_PAD_MONITOR_PARENT_UNLOCK (pad_monitor);
@ -1475,6 +1486,9 @@ gst_validate_pad_monitor_chain_func (GstPad * pad, GstObject * parent,
GST_VALIDATE_MONITOR_LOCK (pad_monitor);
pad_monitor->last_flow_return = ret;
if (ret == GST_FLOW_EOS) {
pad_monitor->is_eos = ret;
}
if (PAD_PARENT_IS_DEMUXER (pad_monitor))
gst_validate_pad_monitor_check_aggregated_return (pad_monitor, ret);
@ -1630,6 +1644,7 @@ gst_validate_pad_monitor_buffer_probe (GstPad * pad, GstBuffer * 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);
if (PAD_PARENT_IS_DECODER (monitor) || PAD_PARENT_IS_ENCODER (monitor)) {
GstClockTime tolerance = 0;

View file

@ -120,6 +120,9 @@ gst_validate_report_load_issues (void)
_("flow return from a 1:1 sink/src pad element is as simple as "
"returning what downstream returned. For elements that have multiple "
"src pads, flow returns should be properly combined"));
REGISTER_VALIDATE_ISSUE (ISSUE, BUFFER_AFTER_EOS,
_("buffer was received after EOS"),
_("a pad shouldn't receive any more buffers after it gets EOS"));
REGISTER_VALIDATE_ISSUE (ISSUE, CAPS_IS_MISSING_FIELD,
_("caps is missing a required field for its type"),

View file

@ -73,6 +73,7 @@ typedef enum {
#define GST_VALIDATE_ISSUE_ID_BUFFER_TIMESTAMP_OUT_OF_RECEIVED_RANGE (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 3)
#define GST_VALIDATE_ISSUE_ID_FIRST_BUFFER_RUNNING_TIME_IS_NOT_ZERO (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 4)
#define GST_VALIDATE_ISSUE_ID_WRONG_FLOW_RETURN (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 5)
#define GST_VALIDATE_ISSUE_ID_BUFFER_AFTER_EOS (((GstValidateIssueId) GST_VALIDATE_AREA_BUFFER) << GST_VALIDATE_ISSUE_ID_SHIFT | 6)
#define GST_VALIDATE_ISSUE_ID_CAPS_IS_MISSING_FIELD (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_CAPS_FIELD_HAS_BAD_TYPE (((GstValidateIssueId) GST_VALIDATE_AREA_CAPS) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)