oggdemux: gather some more stats about bisection
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Fri, 21 Oct 2011 18:38:19 +0000 (19:38 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 24 Nov 2011 09:48:15 +0000 (10:48 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=662475

ext/ogg/gstoggdemux.c
ext/ogg/gstoggdemux.h

index 2426b72..4198f6c 100644 (file)
@@ -1440,6 +1440,19 @@ gst_ogg_pad_handle_push_mode_state (GstOggPad * pad, ogg_page * page)
           }
           GST_INFO_OBJECT (ogg, "Bisection needed %d + %d steps",
               ogg->push_bisection_steps[0], ogg->push_bisection_steps[1]);
+          ogg->stats_bisection_steps[0] += ogg->push_bisection_steps[0];
+          ogg->stats_bisection_steps[1] += ogg->push_bisection_steps[1];
+          if (ogg->stats_bisection_max_steps[0] < ogg->push_bisection_steps[0])
+            ogg->stats_bisection_max_steps[0] = ogg->push_bisection_steps[0];
+          if (ogg->stats_bisection_max_steps[1] < ogg->push_bisection_steps[1])
+            ogg->stats_bisection_max_steps[1] = ogg->push_bisection_steps[1];
+          ogg->stats_nbisections++;
+          GST_INFO_OBJECT (ogg,
+              "So far, %.2f + %.2f bisections needed per seek (max %d + %d)",
+              ogg->stats_bisection_steps[0] / (float) ogg->stats_nbisections,
+              ogg->stats_bisection_steps[1] / (float) ogg->stats_nbisections,
+              ogg->stats_bisection_max_steps[0],
+              ogg->stats_bisection_max_steps[1]);
         }
       }
     } else if (ogg->push_state == PUSH_LINEAR1) {
@@ -1853,6 +1866,12 @@ gst_ogg_demux_init (GstOggDemux * ogg, GstOggDemuxClass * g_class)
   ogg->push_lock = g_mutex_new ();
   ogg->chains = g_array_new (FALSE, TRUE, sizeof (GstOggChain *));
 
+  ogg->stats_nbisections = 0;
+  ogg->stats_bisection_steps[0] = 0;
+  ogg->stats_bisection_steps[1] = 0;
+  ogg->stats_bisection_max_steps[0] = 0;
+  ogg->stats_bisection_max_steps[1] = 0;
+
   ogg->newsegment = NULL;
 }
 
index 712dc8f..fea4c60 100644 (file)
@@ -188,6 +188,9 @@ struct _GstOggDemux
   gboolean push_disable_seeking;
 
   gint push_bisection_steps[2];
+  gint stats_bisection_steps[2];
+  gint stats_bisection_max_steps[2];
+  gint stats_nbisections;
 
   /* ogg stuff */
   ogg_sync_state sync;