mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
avi: add some performance measurements
Measure the performance of various index and header parsing steps to the PERFORMANCE debug category.
This commit is contained in:
parent
50c41acdff
commit
2f26ee4285
1 changed files with 38 additions and 4 deletions
|
@ -54,6 +54,7 @@
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (avidemux_debug);
|
GST_DEBUG_CATEGORY_STATIC (avidemux_debug);
|
||||||
#define GST_CAT_DEFAULT avidemux_debug
|
#define GST_CAT_DEFAULT avidemux_debug
|
||||||
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_EVENT);
|
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_EVENT);
|
||||||
|
|
||||||
|
@ -173,6 +174,7 @@ gst_avi_demux_class_init (GstAviDemuxClass * klass)
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (avidemux_debug, "avidemux",
|
GST_DEBUG_CATEGORY_INIT (avidemux_debug, "avidemux",
|
||||||
0, "Demuxer for AVI streams");
|
0, "Demuxer for AVI streams");
|
||||||
|
GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
|
@ -862,6 +864,9 @@ static gboolean
|
||||||
gst_avi_demux_parse_file_header (GstElement * element, GstBuffer * buf)
|
gst_avi_demux_parse_file_header (GstElement * element, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
guint32 doctype;
|
guint32 doctype;
|
||||||
|
GstClockTime stamp;
|
||||||
|
|
||||||
|
stamp = gst_util_get_timestamp ();
|
||||||
|
|
||||||
/* riff_parse posts an error */
|
/* riff_parse posts an error */
|
||||||
if (!gst_riff_parse_file_header (element, buf, &doctype))
|
if (!gst_riff_parse_file_header (element, buf, &doctype))
|
||||||
|
@ -870,6 +875,10 @@ gst_avi_demux_parse_file_header (GstElement * element, GstBuffer * buf)
|
||||||
if (doctype != GST_RIFF_RIFF_AVI)
|
if (doctype != GST_RIFF_RIFF_AVI)
|
||||||
goto not_avi;
|
goto not_avi;
|
||||||
|
|
||||||
|
stamp = gst_util_get_timestamp () - stamp;
|
||||||
|
GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "parsing header %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (stamp));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -1993,10 +2002,10 @@ gst_avi_demux_parse_index (GstAviDemux * avi,
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
GList *entries_list = NULL;
|
GList *entries_list = NULL;
|
||||||
guint i, num, n;
|
guint i, num, n;
|
||||||
|
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
gulong _nr_keyframes = 0;
|
gulong _nr_keyframes = 0;
|
||||||
#endif
|
#endif
|
||||||
|
GstClockTime stamp;
|
||||||
|
|
||||||
if (!buf || !GST_BUFFER_SIZE (buf)) {
|
if (!buf || !GST_BUFFER_SIZE (buf)) {
|
||||||
*_entries_list = NULL;
|
*_entries_list = NULL;
|
||||||
|
@ -2006,6 +2015,8 @@ gst_avi_demux_parse_index (GstAviDemux * avi,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stamp = gst_util_get_timestamp ();
|
||||||
|
|
||||||
data = GST_BUFFER_DATA (buf);
|
data = GST_BUFFER_DATA (buf);
|
||||||
num = GST_BUFFER_SIZE (buf) / sizeof (gst_riff_index_entry);
|
num = GST_BUFFER_SIZE (buf) / sizeof (gst_riff_index_entry);
|
||||||
if (!(entries = g_try_new (gst_avi_index_entry, num)))
|
if (!(entries = g_try_new (gst_avi_index_entry, num)))
|
||||||
|
@ -2133,6 +2144,11 @@ gst_avi_demux_parse_index (GstAviDemux * avi,
|
||||||
} else {
|
} else {
|
||||||
g_free (entries);
|
g_free (entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stamp = gst_util_get_timestamp () - stamp;
|
||||||
|
GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "parsing index %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (stamp));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -2700,6 +2716,9 @@ gst_avi_demux_massage_index (GstAviDemux * avi,
|
||||||
guint i;
|
guint i;
|
||||||
GList *node;
|
GList *node;
|
||||||
gint64 delay = G_GINT64_CONSTANT (0);
|
gint64 delay = G_GINT64_CONSTANT (0);
|
||||||
|
GstClockTime stamp;
|
||||||
|
|
||||||
|
stamp = gst_util_get_timestamp ();
|
||||||
|
|
||||||
GST_LOG_OBJECT (avi, "Starting index massage, nr_entries = %d",
|
GST_LOG_OBJECT (avi, "Starting index massage, nr_entries = %d",
|
||||||
list ? g_list_length (list) : 0);
|
list ? g_list_length (list) : 0);
|
||||||
|
@ -2872,14 +2891,22 @@ gst_avi_demux_massage_index (GstAviDemux * avi,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GST_LOG_OBJECT (avi, "Index massaging done");
|
GST_LOG_OBJECT (avi, "Index massaging done");
|
||||||
|
|
||||||
|
stamp = gst_util_get_timestamp () - stamp;
|
||||||
|
|
||||||
|
GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "massaging index %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (stamp));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
out_of_mem:
|
out_of_mem:
|
||||||
|
{
|
||||||
GST_WARNING_OBJECT (avi, "Out of memory for %" G_GSIZE_FORMAT " bytes",
|
GST_WARNING_OBJECT (avi, "Out of memory for %" G_GSIZE_FORMAT " bytes",
|
||||||
sizeof (gst_avi_index_entry) * avi->index_size);
|
sizeof (gst_avi_index_entry) * avi->index_size);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_avi_demux_calculate_durations_from_index (GstAviDemux * avi)
|
gst_avi_demux_calculate_durations_from_index (GstAviDemux * avi)
|
||||||
|
@ -3261,6 +3288,9 @@ gst_avi_demux_stream_header_pull (GstAviDemux * avi)
|
||||||
guint offset = 4;
|
guint offset = 4;
|
||||||
gint64 stop;
|
gint64 stop;
|
||||||
GstElement *element = GST_ELEMENT_CAST (avi);
|
GstElement *element = GST_ELEMENT_CAST (avi);
|
||||||
|
GstClockTime stamp;
|
||||||
|
|
||||||
|
stamp = gst_util_get_timestamp ();
|
||||||
|
|
||||||
/* the header consists of a 'hdrl' LIST tag */
|
/* the header consists of a 'hdrl' LIST tag */
|
||||||
res = gst_riff_read_chunk (element, avi->sinkpad, &avi->offset, &tag, &buf);
|
res = gst_riff_read_chunk (element, avi->sinkpad, &avi->offset, &tag, &buf);
|
||||||
|
@ -3492,6 +3522,10 @@ skipping_done:
|
||||||
(FALSE, avi->segment.rate, GST_FORMAT_TIME,
|
(FALSE, avi->segment.rate, GST_FORMAT_TIME,
|
||||||
avi->segment.start, stop, avi->segment.start);
|
avi->segment.start, stop, avi->segment.start);
|
||||||
|
|
||||||
|
stamp = gst_util_get_timestamp () - stamp;
|
||||||
|
GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "pulling header %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (stamp));
|
||||||
|
|
||||||
/* at this point we know all the streams and we can signal the no more
|
/* at this point we know all the streams and we can signal the no more
|
||||||
* pads signal */
|
* pads signal */
|
||||||
GST_DEBUG_OBJECT (avi, "signaling no more pads");
|
GST_DEBUG_OBJECT (avi, "signaling no more pads");
|
||||||
|
|
Loading…
Reference in a new issue