validate: Add a new issue to detect invalid event seqnum
authorEdward Hervey <edward@centricular.com>
Tue, 5 Jun 2018 14:36:24 +0000 (16:36 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Tue, 5 Jun 2018 14:37:35 +0000 (16:37 +0200)
Events should always have a valid seqnum. Add a new issue which
allows detecting such events. And use that check in the
pad monitor

validate/gst/validate/gst-validate-pad-monitor.c
validate/gst/validate/gst-validate-report.c
validate/gst/validate/gst-validate-report.h

index a81f104..a42634b 100644 (file)
@@ -1616,6 +1616,11 @@ gst_validate_pad_monitor_common_event_check (GstValidatePadMonitor *
 {
   guint32 seqnum = gst_event_get_seqnum (event);
 
+  if (seqnum == GST_SEQNUM_INVALID)
+    GST_VALIDATE_REPORT (pad_monitor, EVENT_INVALID_SEQNUM,
+        "Event %p (%s) has an invalid SEQNUM", event,
+        GST_EVENT_TYPE_NAME (event));
+
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_FLUSH_START:
     {
index e773f75..e67d5c5 100644 (file)
@@ -342,6 +342,10 @@ gst_validate_report_load_issues (void)
           " EOS being some kind of data flow, there is no exception"
           " in that regard"));
 
+  REGISTER_VALIDATE_ISSUE (CRITICAL, EVENT_INVALID_SEQNUM,
+      _("Event has an invalid seqnum"),
+      _("An event is using GST_SEQNUM_INVALID. This should never happen"));
+
   REGISTER_VALIDATE_ISSUE (CRITICAL, STATE_CHANGE_FAILURE,
       _("state change failed"), NULL);
 
index c701f3a..09db598 100644 (file)
@@ -92,6 +92,7 @@ typedef enum {
 #define EVENT_SEEK_NOT_HANDLED                   _QUARK("event::seek-not-handled")
 #define EVENT_SEEK_RESULT_POSITION_WRONG         _QUARK("event::seek-result-position-wrong")
 #define EVENT_EOS_WITHOUT_SEGMENT                _QUARK("event::eos-without-segment")
+#define EVENT_INVALID_SEQNUM                     _QUARK("event::invalid-seqnum")
 
 #define STATE_CHANGE_FAILURE                     _QUARK("state::change-failure")