collectpads: correct some comments and add more logging
authorStefan Sauer <ensonic@users.sf.net>
Sun, 9 Jul 2017 19:16:44 +0000 (21:16 +0200)
committerStefan Sauer <ensonic@users.sf.net>
Sun, 9 Jul 2017 19:17:43 +0000 (21:17 +0200)
Add more logging to analyze event handling (especially failure cases).

libs/gst/base/gstcollectpads.c

index ad62211..0a990b2 100644 (file)
@@ -94,7 +94,7 @@ struct _GstCollectPadsPrivate
   gboolean started;
 
   /* with STREAM_LOCK */
-  guint32 cookie;               /* @data list cookie */
+  guint32 cookie;               /* pad_list cookie */
   guint numpads;                /* number of pads in @data */
   guint queuedpads;             /* number of pads with a buffer */
   guint eospads;                /* number of pads that are EOS */
@@ -102,7 +102,7 @@ struct _GstCollectPadsPrivate
   GstCollectData *earliest_data;        /* Pad data for current earliest time */
 
   /* with LOCK */
-  GSList *pad_list;             /* updated pad list */
+  GSList *pad_list;             /* list of GstCollectData* */
   guint32 pad_cookie;           /* updated cookie */
 
   GstCollectPadsFunction func;  /* function and user_data for callback */
@@ -784,6 +784,8 @@ gst_collect_pads_set_flushing_unlocked (GstCollectPads * pads,
 {
   GSList *walk = NULL;
 
+  GST_DEBUG ("sink-pads flushing=%d", flushing);
+
   /* Update the pads flushing flag */
   for (walk = pads->priv->pad_list; walk; walk = g_slist_next (walk)) {
     GstCollectData *cdata = walk->data;
@@ -1677,6 +1679,8 @@ gst_collect_pads_event_default (GstCollectPads * pads, GstCollectData * data,
   pad = data->pad;
   parent = GST_OBJECT_PARENT (pad);
 
+  GST_DEBUG_OBJECT (pad, "Got '%s' event", GST_EVENT_TYPE_NAME (event));
+
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_FLUSH_START:
     {
@@ -1707,7 +1711,9 @@ gst_collect_pads_event_default (GstCollectPads * pads, GstCollectData * data,
       } else {
         /* forward event to unblock check_collected */
         GST_DEBUG_OBJECT (pad, "forwarding flush start");
-        res = gst_pad_event_default (pad, parent, event);
+        if (!(res = gst_pad_event_default (pad, parent, event))) {
+          GST_WARNING_OBJECT (pad, "forwarding flush start failed");
+        }
         event = NULL;
 
         /* now unblock the chain function.
@@ -1857,6 +1863,7 @@ gst_collect_pads_event_default (GstCollectPads * pads, GstCollectData * data,
   }
 
 eat:
+  GST_DEBUG_OBJECT (pads, "dropping event: %" GST_PTR_FORMAT, event);
   if (event)
     gst_event_unref (event);
   return res;
@@ -1864,8 +1871,10 @@ eat:
 forward:
   if (discard)
     goto eat;
-  else
+  else {
+    GST_DEBUG_OBJECT (pads, "forward event: %" GST_PTR_FORMAT, event);
     return gst_pad_event_default (pad, parent, event);
+  }
 }
 
 typedef struct