pad-monitor: New check for duplicate caps event

We shouldn't get/push twice caps that are identical
This commit is contained in:
Edward Hervey 2013-08-23 09:16:43 +02:00 committed by Thiago Santos
parent 104cccdfc0
commit e48eadad75
4 changed files with 21 additions and 0 deletions

View file

@ -1513,6 +1513,13 @@ gst_validate_pad_monitor_setcaps_pre (GstValidatePadMonitor * pad_monitor,
{
GstStructure *structure;
/* Check if caps are identical to last caps and complain if so */
if (pad_monitor->last_caps
&& gst_caps_is_equal (caps, pad_monitor->last_caps)) {
GST_VALIDATE_REPORT (pad_monitor, EVENT_CAPS_DUPLICATE, "%" GST_PTR_FORMAT,
caps);
}
gst_validate_pad_monitor_check_caps_complete (pad_monitor, caps);
if (caps) {
@ -1574,6 +1581,12 @@ gst_validate_pad_monitor_setcaps_post (GstValidatePadMonitor * pad_monitor,
{
if (!ret)
gst_validate_pad_monitor_otherpad_clear_pending_fields (pad_monitor);
else {
if (pad_monitor->last_caps) {
gst_caps_unref (pad_monitor->last_caps);
}
pad_monitor->last_caps = gst_caps_ref (caps);
}
}
static gboolean
@ -1596,6 +1609,8 @@ gst_validate_pad_monitor_do_setup (GstValidateMonitor * monitor)
g_object_set_data ((GObject *) pad, "qa-monitor", pad_monitor);
pad_monitor->pad = pad;
pad_monitor->event_func = GST_PAD_EVENTFUNC (pad);
pad_monitor->query_func = GST_PAD_QUERYFUNC (pad);
if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) {

View file

@ -68,6 +68,9 @@ struct _GstValidatePadMonitor {
gulong pad_probe_id;
/*< private >*/
/* Last caps pushed/received */
GstCaps *last_caps;
/* FIXME : Let's migrate all those booleans into a 32 (or 64) bit flag */
gboolean first_buffer;
gboolean has_segment;

View file

@ -164,6 +164,8 @@ gst_validate_report_load_issues (void)
_("received an unexpected flush start event"), NULL);
REGISTER_VALIDATE_ISSUE (WARNING, EVENT_FLUSH_STOP_UNEXPECTED,
_("received an unexpected flush stop event"), NULL);
REGISTER_VALIDATE_ISSUE (WARNING, EVENT_CAPS_DUPLICATE,
_("received the same caps twice"), NULL);
REGISTER_VALIDATE_ISSUE (CRITICAL, EVENT_SEEK_NOT_HANDLED,
_("seek event wasn't handled"), NULL);

View file

@ -86,6 +86,7 @@ typedef enum {
#define GST_VALIDATE_ISSUE_ID_EVENT_NEW_SEGMENT_MISMATCH (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 5)
#define GST_VALIDATE_ISSUE_ID_EVENT_FLUSH_START_UNEXPECTED (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 6)
#define GST_VALIDATE_ISSUE_ID_EVENT_FLUSH_STOP_UNEXPECTED (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 7)
#define GST_VALIDATE_ISSUE_ID_EVENT_CAPS_DUPLICATE (((GstValidateIssueId) GST_VALIDATE_AREA_EVENT) << GST_VALIDATE_ISSUE_ID_SHIFT | 8)
#define GST_VALIDATE_ISSUE_ID_EVENT_SEEK_NOT_HANDLED (((GstValidateIssueId) GST_VALIDATE_AREA_SEEK) << GST_VALIDATE_ISSUE_ID_SHIFT | 1)
#define GST_VALIDATE_ISSUE_ID_EVENT_SEEK_RESULT_POSITION_WRONG (((GstValidateIssueId) GST_VALIDATE_AREA_SEEK) << GST_VALIDATE_ISSUE_ID_SHIFT | 2)