v4l2: log buffer copies on queue underrun in perf category

v4l2src has a slow path where it does buffer-copies when it runs out of queued
buffers. Log this to performance category to help monitoring it.
This commit is contained in:
Stefan Kost 2009-09-11 22:15:01 +03:00
parent 0c50816aaa
commit 1a945a32cc
2 changed files with 7 additions and 0 deletions

View file

@ -38,11 +38,13 @@
/* used in v4l2_calls.c and v4l2src_calls.c */
GST_DEBUG_CATEGORY (v4l2_debug);
GST_DEBUG_CATEGORY (GST_CAT_PERFORMANCE);
static gboolean
plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (v4l2_debug, "v4l2", 0, "V4L2 API calls");
GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
if (!gst_element_register (plugin, "v4l2src", GST_RANK_PRIMARY,
GST_TYPE_V4L2SRC) ||

View file

@ -49,6 +49,7 @@
GST_DEBUG_CATEGORY_EXTERN (v4l2src_debug);
#define GST_CAT_DEFAULT v4l2src_debug
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
/* lalala... */
#define GST_V4L2_SET_ACTIVE(element) (element)->buffer = GINT_TO_POINTER (-1)
@ -157,6 +158,10 @@ gst_v4l2src_grab_frame (GstV4l2Src * v4l2src, GstBuffer ** buf)
|| !gst_v4l2_buffer_pool_available_buffers (pool);
if (G_UNLIKELY (need_copy)) {
if (!v4l2src->always_copy) {
GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, v4l2src,
"running out of buffers, making a copy to reuse current one");
}
*buf = gst_buffer_copy (pool_buffer);
GST_BUFFER_FLAG_UNSET (*buf, GST_BUFFER_FLAG_READONLY);
/* this will requeue */