validate: Be more precise in issue type for wrong seqnum
authorThibault Saunier <tsaunier@gnome.org>
Thu, 30 Oct 2014 13:10:33 +0000 (14:10 +0100)
committerThibault Saunier <tsaunier@gnome.org>
Sun, 16 Nov 2014 17:27:32 +0000 (18:27 +0100)
Depending on the type of event where the bug occurs,
it is not the same issue type. That allows us to have
much precise reports, and better explain the user
where the issue stands.

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

index 39d98b0..aa66857 100644 (file)
@@ -122,7 +122,7 @@ typedef struct
 } SerializedEventData;
 
 static GstPad *
-_get_actual_pad (GstPad *pad)
+_get_actual_pad (GstPad * pad)
 {
   GstPad *tmp_pad;
 
@@ -1408,10 +1408,9 @@ gst_validate_pad_monitor_common_event_check (GstValidatePadMonitor *
         if (seqnum == pad_monitor->pending_flush_start_seqnum) {
           pad_monitor->pending_flush_start_seqnum = 0;
         } else {
-          GST_VALIDATE_REPORT (pad_monitor, EVENT_HAS_WRONG_SEQNUM,
-              "The expected flush-start seqnum should be the same as the "
-              "one from the event that caused it (probably a seek). Got: %u."
-              " Expected: %u", seqnum, pad_monitor->pending_flush_start_seqnum);
+          GST_VALIDATE_REPORT (pad_monitor, FLUSH_START_HAS_WRONG_SEQNUM,
+              "Got: %u Expected: %u", seqnum,
+              pad_monitor->pending_flush_start_seqnum);
         }
       }
 
@@ -1428,10 +1427,9 @@ gst_validate_pad_monitor_common_event_check (GstValidatePadMonitor *
         if (seqnum == pad_monitor->pending_flush_stop_seqnum) {
           pad_monitor->pending_flush_stop_seqnum = 0;
         } else {
-          GST_VALIDATE_REPORT (pad_monitor, EVENT_HAS_WRONG_SEQNUM,
-              "The expected flush-stop seqnum should be the same as the "
-              "one from the event that caused it (probably a seek). Got: %u."
-              " Expected: %u", seqnum, pad_monitor->pending_flush_stop_seqnum);
+          GST_VALIDATE_REPORT (pad_monitor, FLUSH_STOP_HAS_WRONG_SEQNUM,
+              "Got: %u Expected: %u", seqnum,
+              pad_monitor->pending_flush_stop_seqnum);
         }
       }
 
@@ -1457,7 +1455,7 @@ gst_validate_pad_monitor_common_event_check (GstValidatePadMonitor *
 }
 
 static void
-mark_pads_eos (GstValidatePadMonitor *pad_monitor)
+mark_pads_eos (GstValidatePadMonitor * pad_monitor)
 {
   GstValidatePadMonitor *peer_monitor;
   GstPad *peer = gst_pad_get_peer (pad_monitor->pad);
@@ -1466,7 +1464,8 @@ mark_pads_eos (GstValidatePadMonitor *pad_monitor)
   pad_monitor->is_eos = TRUE;
   if (peer) {
     real_peer = _get_actual_pad (peer);
-    peer_monitor = g_object_get_data ((GObject *) real_peer, "validate-monitor");
+    peer_monitor =
+        g_object_get_data ((GObject *) real_peer, "validate-monitor");
     if (peer_monitor)
       peer_monitor->is_eos = TRUE;
     gst_object_unref (peer);
@@ -1587,10 +1586,8 @@ gst_validate_pad_monitor_downstream_event_check (GstValidatePadMonitor *
         if (pad_monitor->pending_newsegment_seqnum == seqnum) {
           pad_monitor->pending_newsegment_seqnum = 0;
         } else {
-          GST_VALIDATE_REPORT (pad_monitor, EVENT_HAS_WRONG_SEQNUM,
-              "The expected segment seqnum should be the same as the "
-              "one from the seek that caused it. Got: %u."
-              " Expected: %u", seqnum, pad_monitor->pending_eos_seqnum);
+          GST_VALIDATE_REPORT (pad_monitor, SEGMENT_HAS_WRONG_SEQNUM,
+              "Got: %u Expected: %u", seqnum, pad_monitor->pending_eos_seqnum);
         }
       }
 
@@ -1635,10 +1632,8 @@ gst_validate_pad_monitor_downstream_event_check (GstValidatePadMonitor *
             "EOS %" GST_PTR_FORMAT " received before a segment was received",
             event);
       } else if (pad_monitor->pending_eos_seqnum != seqnum) {
-        GST_VALIDATE_REPORT (pad_monitor, EVENT_HAS_WRONG_SEQNUM,
-            "The expected EOS seqnum should be the same as the "
-            "one from the seek that caused it. Got: %u."
-            " Expected: %u", seqnum, pad_monitor->pending_eos_seqnum);
+        GST_VALIDATE_REPORT (pad_monitor, EOS_HAS_WRONG_SEQNUM,
+            "Got: %u. Expected: %u", seqnum, pad_monitor->pending_eos_seqnum);
       }
 
       /*
index 58bf1c3..0e15f7d 100644 (file)
@@ -198,8 +198,28 @@ gst_validate_report_load_issues (void)
           "received and serialized with buffers. If an event is received after"
           " a buffer with timestamp end 'X', it should be pushed right after "
           "buffers with timestamp end 'X'"));
-  REGISTER_VALIDATE_ISSUE (ISSUE, EVENT_HAS_WRONG_SEQNUM,
-      _("events that are part of the same pipeline 'operation' should "
+  REGISTER_VALIDATE_ISSUE (ISSUE, EOS_HAS_WRONG_SEQNUM,
+      _("EOS events that are part of the same pipeline 'operation' should "
+          "have the same seqnum"),
+      _("when events/messages are created from another event/message, "
+          "they should have their seqnums set to the original event/message "
+          "seqnum"));
+  REGISTER_VALIDATE_ISSUE (ISSUE, FLUSH_START_HAS_WRONG_SEQNUM,
+      _
+      ("FLUSH_START events that are part of the same pipeline 'operation' should "
+          "have the same seqnum"),
+      _("when events/messages are created from another event/message, "
+          "they should have their seqnums set to the original event/message "
+          "seqnum"));
+  REGISTER_VALIDATE_ISSUE (ISSUE, FLUSH_STOP_HAS_WRONG_SEQNUM,
+      _
+      ("FLUSH_STOP events that are part of the same pipeline 'operation' should "
+          "have the same seqnum"),
+      _("when events/messages are created from another event/message, "
+          "they should have their seqnums set to the original event/message "
+          "seqnum"));
+  REGISTER_VALIDATE_ISSUE (ISSUE, SEGMENT_HAS_WRONG_SEQNUM,
+      _("SEGMENT events that are part of the same pipeline 'operation' should "
           "have the same seqnum"),
       _("when events/messages are created from another event/message, "
           "they should have their seqnums set to the original event/message "
index 6d7b8ff..e7ee42a 100644 (file)
@@ -72,7 +72,13 @@ typedef enum {
 
 #define EVENT_NEWSEGMENT_NOT_PUSHED              _QUARK("event::newsegment-not-pushed")
 #define SERIALIZED_EVENT_WASNT_PUSHED_IN_TIME    _QUARK("event::serialized-event-wasnt-pushed-in-time")
-#define EVENT_HAS_WRONG_SEQNUM                   _QUARK("event::has-wrong-seqnum")
+
+#define EOS_HAS_WRONG_SEQNUM                    _QUARK("event::eos-has-wrong-seqnum")
+#define FLUSH_START_HAS_WRONG_SEQNUM            _QUARK("event::flush-start-has-wrong-seqnum")
+#define FLUSH_STOP_HAS_WRONG_SEQNUM             _QUARK("event::flush-stop-has-wrong-seqnum")
+#define SEGMENT_HAS_WRONG_SEQNUM                _QUARK("event::segment-has-wrong-seqnum")
+
+
 #define EVENT_SERIALIZED_OUT_OF_ORDER            _QUARK("event::serialized-out-of-order")
 #define EVENT_NEW_SEGMENT_MISMATCH               _QUARK("event::segment-mismatch")
 #define EVENT_FLUSH_START_UNEXPECTED             _QUARK("event::flush-start-unexpected")