pad-monitor: also track eos event that should be emitted after a seek
authorThiago Santos <thiago.sousa.santos@collabora.com>
Mon, 2 Sep 2013 13:46:55 +0000 (10:46 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Mon, 2 Sep 2013 13:46:55 +0000 (10:46 -0300)
When seeking out of the media file length, the element should push an
EOS with the same seqnum of the seek event

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

index a3a4344..4968828 100644 (file)
@@ -1159,6 +1159,9 @@ gst_validate_pad_monitor_downstream_event_check (GstValidatePadMonitor *
         }
       }
 
+      /* got a segment, no need for EOS now */
+      pad_monitor->pending_eos_seqnum = 0;
+
       if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) {
         gst_validate_pad_monitor_add_expected_newsegment (pad_monitor, event);
       } else {
@@ -1186,6 +1189,13 @@ gst_validate_pad_monitor_downstream_event_check (GstValidatePadMonitor *
       break;
     case GST_EVENT_EOS:
       pad_monitor->is_eos = TRUE;
+      if (pad_monitor->pending_eos_seqnum &&
+          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);
+      }
       /*
        * TODO add end of stream checks for
        *  - events not pushed
@@ -1270,6 +1280,7 @@ gst_validate_pad_monitor_src_event_check (GstValidatePadMonitor * pad_monitor,
         pad_monitor->pending_flush_stop_seqnum = seqnum;
       }
       pad_monitor->pending_newsegment_seqnum = seqnum;
+      pad_monitor->pending_eos_seqnum = seqnum;
     }
       break;
       /* both flushes are handled by the common event handling function */
index 5b11dba..e91e740 100644 (file)
@@ -80,6 +80,7 @@ struct _GstValidatePadMonitor {
   guint32 pending_flush_stop_seqnum;
   guint32 pending_flush_start_seqnum;
   guint32 pending_newsegment_seqnum;
+  guint32 pending_eos_seqnum;
 
   GstEvent *expected_segment;
   GPtrArray *serialized_events;