GST_DEBUG_CATEGORY_EXTERN(gst_debug_vaapi);
#define GST_CAT_DEFAULT gst_debug_vaapi
#endif
+/* FPS Calculation for DEBUG */
+#define FPS_CALCULATION(objname) \
+ do{ \
+ static guint num_frame = 0; \
+ static struct timeval last_sys_time; \
+ static struct timeval first_sys_time; \
+ static int b_last_sys_time_init = FALSE; \
+ if (!b_last_sys_time_init) { \
+ gettimeofday (&last_sys_time, NULL); \
+ gettimeofday (&first_sys_time, NULL); \
+ b_last_sys_time_init = TRUE; \
+ } else { \
+ if ((num_frame%50)==0) { \
+ double total, current; \
+ struct timeval cur_sys_time; \
+ gettimeofday (&cur_sys_time, NULL); \
+ total = (cur_sys_time.tv_sec - first_sys_time.tv_sec)*1.0f + \
+ (cur_sys_time.tv_usec - first_sys_time.tv_usec)/1000000.0f; \
+ current = (cur_sys_time.tv_sec - last_sys_time.tv_sec)*1.0f + \
+ (cur_sys_time.tv_usec - last_sys_time.tv_usec)/1000000.0f; \
+ printf("%s Current fps: %.2f, Total avg fps: %.2f\n", \
+ #objname, (float)50.0f/current, (float)num_frame/total); \
+ last_sys_time = cur_sys_time; \
+ } \
+ } \
+ ++num_frame; \
+ }while(0)
+
#endif /* GST_VAAPI_DEBUG_H */
if (!gst_vaapi_surface_put_image(surface, image))
goto error_put_image;
}
- return GST_FLOW_OK;
+ goto flow_ok;
}
image = gst_vaapi_video_pool_get_object(upload->images);
gst_vaapi_video_pool_put_object(upload->images, image);
if (!success)
goto error_put_image;
+
+flow_ok:
+ FPS_CALCULATION(vaapiconvert);
return GST_FLOW_OK;
error_put_image: